1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-09-04 12:53:25 +02:00
tldr/pages/common/uniq.md
Waldir Pimenta fd5fb3562d uniq: add sorting example (#945)
This involves another command, but it's such a natural extension of uniq's `-c` functionality that I feel it's warranted to show here.

We should probably add a sort to the -c example too, because uniq only deals with *sequential* line repetitions.
2016-07-10 11:26:13 +02:00

23 lines
404 B
Markdown

# uniq
> Output the unique lines from the given input or file.
- Display each line once:
`uniq {{file}}`
- Display only unique lines:
`uniq -u {{file}}`
- Display only duplicate lines:
`uniq -d {{file}}`
- Display number of occurences of each line along with that line:
`uniq -c {{file}}`
- Display number of occurences of each line, sorted by the most frequent:
`uniq -c {{file}} | sort -nr`