
Text Processing
How to Sort by Column Numerically and by Multiple Keys
Sort by column in the shell: -k field ranges, numeric, human size and version sorting, multiple keys, custom separators, stable sorts and locale pitfalls.
6 min read
Tag
3 posts

Sort by column in the shell: -k field ranges, numeric, human size and version sorting, multiple keys, custom separators, stable sorts and locale pitfalls.

Count unique values and find the top N items with sort and uniq -c: frequency tables, sort -rn, head, case folding, and why uniq needs sorted input.

Sort IP addresses and version numbers correctly with sort -V, sort -t. -k keys, and a zero-padding fallback, and see why plain sort gets them wrong.