<syntaxhighlight lang="awk" name="avg">

#!/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

<syntaxhighlight lang="awk" name="avg">

#!/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