mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-08-23 03:24:00 +02:00

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.
404 B
404 B
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