Use AWK for sum and average


Found a handy snippet for getting the sum and average of some data in a text file using AWK.

Just run the below query on your data

awk '{ s += $1 } END { print "sum: ", s, " average: ", s/NR, " samples: ", NR }'