This commit is contained in:
2008-03-21 22:17:04 +00:00
parent b52f039c69
commit ba21ec2208
4 changed files with 34 additions and 42 deletions

View File

@@ -1,13 +1,17 @@
BEGIN { FS = "\t"; }
{ pop[$4] += $3; }
END {
# 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)
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' +1rn";
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.
close ("sort -t'\t' +1rn");
close ("sort -t'\t' -k2 -rn");
sleep (1);
}