Tools (工具)
Thursday, 17 November 2016
Calculate and print the summation of a column using awk
Calculate the summation of all the number in column
1
in file test.txt and print out the result.
cat test.txt | awk '{s+=$
1
} END {printf "%.0f\n", s}'
http://stackoverflow.com/questions/450799/shell-command-to-sum-integers-one-per-line
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment