qse/regress/awk/cou-027.awk

18 lines
503 B
Awk
Raw Normal View History

BEGIN { FS = "\t"; }
{ pop[$4] += $3; }
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
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";
# 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");
sleep (1);
}