uniq [options] [input [output]]Arguments explained
- -c counts duplicate runs.
- -d prints only repeated lines.
- -u prints only unique lines.
Common examples
sort access.log | uniq -c | sort -nr | headCounts and ranks repeated log lines.
uniq names.txtPrints names with neighboring duplicates collapsed.
| Field | Details |
|---|---|
| Command | uniq |
| Category | Text Processing |
| Primary use | Removes or reports adjacent duplicate lines. |
| Syntax | uniq [options] [input [output]] |