Friday, June 19, 2015

Awk oneliner to count the sum for each row

If you need to count sum of all values for each row in a file, use this awk code:

awk '{for(i=1;i<=NF;i++) t+=$i; print t; t=0}' file.txt

No comments:

Post a Comment