1 2 3 4 5 6 7 8
# Get the mean of a list of numbers { tot += $1 } END { # Error out if we read no values at all if (!NR) exit(1) print tot / NR }