You do not have permission to edit this page, for the following reason:

The action you have requested is limited to users in one of the groups: Users, Administrators.


You can view and copy the source of this page.

Templates used on this page:

Return to Find average of a field on command line.

<syntaxhighlight lang="awk">

#!/usr/bin/awk -f
# Calculate average, syntax: ./avg.awk field-number file
BEGIN {field = ARGV[1]; ARGV[1] = "" }
{ sum += $field }
END { print sum / NR}

</syntaxhighlight>




blog comments powered by Disqus