#!/usr/bin/awk -f BEGIN{ total = 0 count = 0 } $0 !~ /^#/{ total += $2 count ++ } END{ average = total / count print "Total: " total print "Average: " average }