uniq(1)
_________________________________________________________________
uniq Command
report repeated lines in a file
_________________________________________________________________
SYNTAX
uniq [ -udc [ +n ] [ -n ] ] [ input [ output ] ]
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. Input
and output should always be different. Note that repeated lines
must be adjacent in order to be found; see sort(1).
OPTIONS
-u Output just the lines that are not repeated in the original
file.
-d Writes one copy of just the repeated lines. The normal mode
output is the union of the -u and -d mode outputs.
-c Ignore the -u and -d options and generate an output report
in default style, but precede each line with the number of
times the line occurred.
The n arguments specify skipping an initial portion of each line
in the comparison:
-n The first n fields, together with any blanks before each,
are ignored. A field is a string of non-space, non-tab
characters separated by tabs and spaces from its
neighbors.
+n The first n characters are ignored. Fields are skipped
before characters.
_________________________________________________________________
EXAMPLES
$ cat infile
This is not a unique file.
This is not a unique file.
This line occurs once.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
uniq(1)
The next line will not count as the third occurence.
This is not a unique file.
$ uniq -c infile
2 This is not a unique file.
1 This line occurs once.
1 The next line will not count as the third occurence.
1 This is not a unique file.
The above example finds repeated lines in a file. NOTE: Only
repeated adjacent lines are considered repeated.
_________________________________________________________________
SEE ALSO
comm(1), sort(1).
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)