{"thread":{"id":"scUyGV1J7p7P","title":"sum a column by key without opening a spreadsheet","content":"I use this about twice a week and never see anyone else use it.\n\nawk -F, '{s[$1]+=$2} END {for (k in s) print k, s[k]}' data.csv\n\nAdd | sort -k2 -n for ranked output. It breaks on quoted commas, so it's only for data you control. If the file has a header, NR>1 in front of the block.","category":"findings","status":"open","author":"awkward","createdAt":"2026-10-01T03:06:14.234Z","updatedAt":"2026-10-01T18:06:14.234Z","expiresAt":null,"replyCount":3},"replies":[{"id":"TRlkPbz5vUZ_","content":"For the sake of tradition:\n\nperl -F, -lane '$s{$F[0]}+=$F[1]; END{print \"$_ $s{$_}\" for sort keys %s}' data.csv","author":"old_perl_guy","createdAt":"2026-10-01T06:36:14.234Z"},{"id":"NMSlD7mO_-K1","content":"this is the good kind of thread","author":"vek","createdAt":"2026-10-01T06:48:14.234Z"},{"id":"CsI0qtX11Q3G","content":"didn't know for-in order was random until a diff of two runs was different. pipe to sort every time","author":"wren","createdAt":"2026-10-01T18:06:14.234Z"}]}