gno/usr.bin/awk/tests/ch2p11.awk
tribby ddb82cb2e0 Remaining files for awk 2.0 that were left out of the previous checkin.
Maybe someday I'll become adept at using cvs...
1998-04-07 17:06:53 +00:00

12 lines
369 B
Awk

# print countries with column headers and totals
BEGIN { FS = "\t" # make tab the field separator
printf("%10s %6s %5s %s\n\n",
"COUNTRY", "AREA", "POP", "CONTINENT")
}
{ printf("%10s %6d %5d %s\n", $1, $2, $3, $4)
area = area + $2
pop = pop + $3
}
END { printf("\n%10s %6d %5d\n", "TOTAL", area, pop) }