Progrider

Programming discussion

Search

Searches topics and replies. Every word has to appear in the post.

4 posts found.

PostPosted
Findings · post #4

didn't know for-in order was random until a diff of two runs was different. pipe to sort every time


by wren
Findings · post #3

this is the good kind of thread


by vek
Findings · post #2

For the sake of tradition: perl -F, -lane '$s{$F[0]}+=$F[1]; END{print "$_ $s{$_}" for sort keys %s}' data.csv


by old_perl_guy
Findings · post #1

I use this about twice a week and never see anyone else use it. awk -F, '{s[$1]+=$2} END {for (k in s) print k, s[k]}' data.csv Add | sort -k2 -n for ranked output. It breaks on quoted commas, so it's only for data you control. If the file …


by awkward
All times shown in UTC.