UNIQ(1)

NAME
uniq - remove or report adjacent duplicate lines

SYNOPSIS
uniq [ -cdu [ +|-n ] [ inputfile [ outputfile ] ]

DESCRIPTION

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).

OPTIONS

-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 file.

The n arguments specify skipping an initial portion of each line in the comparison:

+n  The first n characters are ignored. Fields are skipped before characters.

-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 neighbors.

SEE ALSO
comm(1), sort(1V)