cheat-fork-echo/cheat/cheatsheets/uniq

19 lines
338 B
Plaintext
Raw Normal View History

2015-01-09 16:28:18 +01:00
# show all lines without duplication
2015-02-10 00:07:17 +01:00
# `sort -u` and `uniq` is the same effect.
2015-01-09 16:28:18 +01:00
sort file | uniq
2015-02-10 00:07:17 +01:00
2015-01-09 16:28:18 +01:00
# show not duplicated lines
sort file | uniq -u
2015-02-10 00:07:17 +01:00
2015-01-09 16:28:18 +01:00
# show duplicated lines only
sort file | uniq -d
2015-02-10 00:07:17 +01:00
2015-01-09 16:28:18 +01:00
# count all lines
sort file | uniq -c
2015-02-10 00:07:17 +01:00
2015-01-09 16:28:18 +01:00
# count not duplicated lines
sort file | uniq -uc
2015-02-10 00:07:17 +01:00
2015-01-09 16:28:18 +01:00
# count only duplicated lines
2015-01-12 13:17:55 +01:00
sort file | uniq -dc