2007-05-02 01:07:00 +00:00
|
|
|
BEGIN { FS = "\t"; }
|
|
|
|
{ pop[$4] += $3; }
|
2007-05-24 15:56:00 +00:00
|
|
|
END {
|
2008-03-21 22:17:04 +00:00
|
|
|
# specifying a postion with + notation seems obsolete for sort
|
|
|
|
# on most platforms.
|
|
|
|
# sort -t'\t' +1rn => sort -t'\t' -k2 -rn
|
|
|
|
|
2007-05-24 15:56:00 +00:00
|
|
|
for (c in pop)
|
2008-03-21 22:17:04 +00:00
|
|
|
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' -k2 -rn";
|
2007-05-24 15:56:00 +00:00
|
|
|
|
|
|
|
# the following two statements make the program behave
|
|
|
|
# consistently across different platforms.
|
|
|
|
# on some platforms, the sort command output has
|
|
|
|
# been delayed until the program exits.
|
2008-03-21 22:17:04 +00:00
|
|
|
close ("sort -t'\t' -k2 -rn");
|
2007-05-24 15:56:00 +00:00
|
|
|
sleep (1);
|
|
|
|
}
|