Friday, 9 December 2016

How to calculate the summation of all the numbers in first column of a file

Calculate the summation of all the number in the first (1) column in file test.stats and print out the result.
cat test.stats |  awk '{s+=$1} END {printf "%.0f\n", s}'

No comments:

Post a Comment