awk array in a row, calculating nth value same row -
i came far create counter , sum row. need range 1 seven, 1 thirty , 1 hundred , eighty summed. therefore tried 2 attempts messy result, none. far know impossible put several commands way 1 after another. may can me. in advance.
awk ' # counter maximum of lines (r=0; r<=181; r++) # array, embracing first 7th, 30th , 180th entry # of 1 row, e.g. $2 e[7, 30, 180] = "total " # if there more 180 goes /dev/null if r==181 > /dev/null # 1 attempt if nf~/^7 && 30 && 180 $/ {print sum} # second attempt # variable sum sum of row number 2 # counting 01 07, 01 30, 01 180 sum=(s += $0) (sum in e) print "sum is", s '
Comments
Post a Comment