mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-05 05:55:46 +00:00
Move pages under tldr, lint run.sh, update docs
This commit is contained in:
30
tldr/uniq
Normal file
30
tldr/uniq
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# uniq
|
||||
|
||||
> Output the unique lines from a input or file.
|
||||
> Since it does not detect repeated lines unless they are adjacent, we need to sort them first.
|
||||
> More information: <https://www.gnu.org/software/coreutils/uniq>.
|
||||
|
||||
- Display each line once:
|
||||
|
||||
`sort {{path/to/file}} | uniq`
|
||||
|
||||
- Display only unique lines:
|
||||
|
||||
`sort {{path/to/file}} | uniq -u`
|
||||
|
||||
- Display only duplicate lines:
|
||||
|
||||
`sort {{path/to/file}} | uniq -d`
|
||||
|
||||
- Display number of occurrences of each line along with that line:
|
||||
|
||||
`sort {{path/to/file}} | uniq -c`
|
||||
|
||||
- Display number of occurrences of each line, sorted by the most frequent:
|
||||
|
||||
`sort {{path/to/file}} | uniq -c | sort -nr`
|
||||
Reference in New Issue
Block a user