Calculate Sum and Average using Awk (Linux)

From ben.goodacre.name/tech

Jump to: navigation, search

Awk can be used to caclulate the sum and average of a particular field:

awk '{ s += $15 } END { print "sum: ", s, " average: ", s/NR, " samples: ", NR }' logfile.log
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox