bash-hacks
latest
archive
categories
about
◐
light
☰
latest
archive
categories
about
◐
light
category 01 / 10
Text processing
Sorting, filtering, reformatting, and slicing text from the terminal.
002
entries
4 min
avg read
all 002
awk 001
logs 001
aggregation 001
arrays 001
sort 001
csv 001
text 001
022
Total a column grouped by another one in a single pass
awk '{n[$7]++; bytes[$7]+=$10} END {for (u in n) printf "%12.0f %6d %s\n", bytes[u], n[u], u}' access.log | sort -rn | head
2026-09-15
4 min
007
Sort a CSV by any column without opening a spreadsheet
sort -t, -k3 -nr sales.csv | head -20
2026-08-24
3 min
showing 002 of 002