#! /usr/bin/awk # Usage: awk -f spamchart of= /^Date: / { theDate = sprintf ("%s %d %d", $4, $3, $5); } /^total\ messages / { if (FNR == 32) { total += $3; printf ("
%s %d
", $3, theDate, $3) > of; } } END { printf ("
Total messages: %d", total) >> of; }