UNIQ(1) General Commands Manual UNIQ(1)
uniq - remove or report adjacent duplicate lines
uniq [ -cdu [ +|-n ] [ inputfile [ outputfile ] ]
uniq reads the input file comparing adjacent lines. In the normal
case, the second and succeeding copies of repeated lines are removed;
the remainder is written on the output file. Note: repeated lines must
be adjacent in order to be found; see sort(1V).
-c Supersede -u and -d and generate an output report in default
style but with each line preceded by a count of the number of
times it occurred.
The normal output of uniq is the union of the -u and -d options.
-d Write one copy of just the repeated lines.
-u Copy only those lines which are not repeated in the original
The n arguments specify skipping an initial portion of each line in the
+n The first n characters are ignored. Fields are skipped before
-n The first n fields together with any blanks before each are
ignored. A field is defined as a string of non-SPACE, non-TAB
characters separated by SPACE and TAB characters from its
9 September 1987 UNIQ(1)