1. cut (Extracting Columns)
cut is used to extract specific columns (fields) from each line of a file. It is perfect for CSV or log files.bash
2. sort (Ordering Data)
sort organizes lines alphabetically or numerically.bash
3. uniq (Removing Duplicates)
uniq filters out adjacent duplicate lines. Wait! Because it only checks adjacent lines, you almost always want to sort your data before using uniq.bash
Putting it all together
Wait! You can combine these three tools into a powerful data analysis pipeline.
bash
Summary
| Tool | Action | Description |
|---|---|---|
| cut | Extract | Picking specific columns |
| sort | Order | Organizing data numerically or alphabetically |
| uniq | Filter | Removing or counting duplicates |
| head | Truncate | Show only the first N lines |
| tail | Truncate | Show only the last N lines |
| Best For | Fast data summaries and reporting | |
| Logic | "Data extraction and aggregation" | |
| Safety | Memory efficient for large files | |
| Modern | Still the fastest way to get a quick count of anything in a log | |
| Standard | Part of the POSIX core utils | |
| Identity | The "One-liner" power tools of the shell |