From a96bd229a6d44651e5f2d1fbf4f9d9208fc6dbd4 Mon Sep 17 00:00:00 2001 From: shigemk2 Date: Sat, 10 Jan 2015 00:28:18 +0900 Subject: [PATCH 1/3] uniq: add examples --- cheat/cheatsheets/uniq | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cheat/cheatsheets/uniq diff --git a/cheat/cheatsheets/uniq b/cheat/cheatsheets/uniq new file mode 100644 index 0000000..994b706 --- /dev/null +++ b/cheat/cheatsheets/uniq @@ -0,0 +1,12 @@ +# show all lines without duplication +sort file | uniq +# show not duplicated lines +sort file | uniq -u +# show duplicated lines only +sort file | uniq -d +# count all lines +sort file | uniq -c +# count not duplicated lines +sort file | uniq -uc +# count only duplicated lines +sort file | uniq -c From 353fe48d60df4a85e30cdf32ce73440a2732430d Mon Sep 17 00:00:00 2001 From: shigemk2 Date: Mon, 12 Jan 2015 21:17:55 +0900 Subject: [PATCH 2/3] Fix dc option --- cheat/cheatsheets/uniq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheat/cheatsheets/uniq b/cheat/cheatsheets/uniq index 994b706..a2bcfc5 100644 --- a/cheat/cheatsheets/uniq +++ b/cheat/cheatsheets/uniq @@ -9,4 +9,4 @@ sort file | uniq -c # count not duplicated lines sort file | uniq -uc # count only duplicated lines -sort file | uniq -c +sort file | uniq -dc From 2e1cda114a7ef0f8ad0ce47756f42e196a1be8cd Mon Sep 17 00:00:00 2001 From: shigemk2 Date: Mon, 12 Jan 2015 21:29:35 +0900 Subject: [PATCH 3/3] Refer sort -u --- cheat/cheatsheets/uniq | 1 + 1 file changed, 1 insertion(+) diff --git a/cheat/cheatsheets/uniq b/cheat/cheatsheets/uniq index a2bcfc5..18ee084 100644 --- a/cheat/cheatsheets/uniq +++ b/cheat/cheatsheets/uniq @@ -1,4 +1,5 @@ # show all lines without duplication +# "sort -u" and "uniq" is the same effect. sort file | uniq # show not duplicated lines sort file | uniq -u