uniq
Displays lines of a file that are unique
uniq [options] [input-file] [output-file]
The uniq utility displays a file, removing all but one copy of successive repeated lines. If the file has been sorted (refer to the sort utility), uniq ensures that no two lines that it displays are the same.
Arguments
When you do not specify the input-file, uniq uses standard input. When you do not specify the output-file, uniq uses standard output.
Options
A field is a sequence of characters bounded by SPACE s, TABs, NEWLINEs, or a combination of these.
--count
-c Precedes each line with the number of occurrences of the line in the input file.
--ignore-case
-i Ignores case when comparing lines.
--repeated
-d Displays one copy of lines that are repeated; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access