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

blog comments powered by Disqus

Sister Sites: GATE Overflow, GATE CSE Wiki, GATE CSE, Aptitude Overflow

This work is licensed under the CC By-SA 3.0 , without all the cruft that would otherwise be put at the bottom of the page.