#! /usr/bin/gawk -f # Reads a file of word counts, as produced by "uniq -c" # Outputs one line with the number of pairs read (excluding "#" lines) # and the total of all the counts. /^#/ {next} /./ { S+=$1; N++; if(NF!=2) { print "bad word" > "/dev/stderr"; abort=1; exit 1 } } END { if(abort) { print 1, 1; exit(1);} print N, S; }