<syntaxhighlight lang="awk" name="avg">
BEGIN {field = ARGV[1]; ARGV[1] = "" } { sum += $field } END { print sum / NR} </syntaxhighlight>
<syntaxhighlight lang="awk" name="avg">
BEGIN {field = ARGV[1]; ARGV[1] = "" } { sum += $field } END { print sum / NR} </syntaxhighlight>