uniq [options] [file1 [file2]]Remove duplicate adjacent lines from sorted file1, sending one copy of each line to file2 (or to standard output). Often used as a filter. Specify only one of -c, -d, or -u. See also comm and sort.
-cPrint each line once, counting instances of each.
-dPrint duplicate lines once, but no unique lines.
-f nIgnore first n fields of a line. Fields are separated by spaces or by tabs. Solaris only.
-s nIgnore first n characters of a field. Solaris only.
-uPrint only unique lines (no copy of duplicate entries is kept).
-nIgnore first n fields of a line. Fields are separated by spaces or by tabs.
Ignore first n characters of a field.
Send one copy of each line from list to output file list.new (list must be sorted):
uniq list list.new
Show which names appear more than once:
sort names | uniq -d
Show which lines appear exactly three times:
sort names | uniq -c | awk '$1 == 3'