Nice article. awk is a fantastic tool to get quick insights into not so large data. This is my take which I wrote last tuesday incidentally http://hkelkar.com/2013/10/15/rolling-up-data-with-awk/
This produces same output as your awk script (except it's sorted alphabetically):
#!/usr/bin/perl -F, -an "$@"
$wins{$F[0]} += $F[6];
$losses{$F[0]} += $F[7];
END {
print "manager,total_wins,total_losses\n"
for (sort keys %wins) {
print "$_,$wins{$_},$losses{$_}\n";
}
}
EDIT: should also mention that you can automatically convert awk scripts to perl with the a2p utility which should already be installed along with perl. #!/usr/local/bin/gawk -E
BEGIN{
FS=","
}
{
total_wins[$1]+=$7;
total_losses[$1]+=$8;
}
END{
print "manager,total_wins,total_losses"
n = asorti(total_wins, managers)
for (i=1; i<=n; i++){
m = managers[i]
print m "," total_wins[m] "," total_losses[m]
}
}
(I recommend using gawk over mawk or nawk. You might need to install it over the awk that came with your OS.)