aboutsummaryrefslogtreecommitdiff
path: root/bin/mean.awk
blob: 98060389ff3e4cfeabb7c86c9fbd27811400524b (plain) (blame)
1
2
3
4
5
6
7
8
9
# Get the mean of a list of numbers
BEGIN { tot = 0 }
{ tot += $1 + 0 }
END {
    # Error out if we read no values at all
    if (!NR)
        exit(1)
    print tot / NR
}