Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

uniq(1) OSS Shell and Utilities Reference Manual
NAME
uniq - Removes or lists repeated lines in a le
SYNOPSIS
Current syntax
uniq [-c | -d | -u][-f elds][-s characters][input_le][output_le]
Obsolescent syntax
uniq [-c | -d | -u][-number][+number][input_le][output_le]
The uniq command reads standard input by default or, the specied input_le compares adjacent
lines, removes the second and succeeding occurrences of a line, and writes to standard output or
the specied le output_le.
FLAGS
-c Precedes each output line with a count of the number of times each line appears in the
le. This ag supersedes -d and -u.
-d Displays repeated lines only.
-f fields Ignores the rst elds elds on each input line when doing comparisons, where elds is
a positive decimal integer. A eld is the maximal string matched by the basic regular
expression:
[[:blank:]]*[ˆ[:blank:]]*
If the elds argument species more elds than appear on an input line, a null string is
used for comparisons.
-s characters
Ignores the specied number of characters when doing comparisons. The characters
argument is a positive decimal integer.
If specied with the -f ag, the rst characters characters after the rst elds elds are
ignored. If the characters argument species more characters than remain on an input
line, uniq uses a null string for comparison.
-u Displays unique lines only.
-number Skips over the rst number elds. A eld is a string of nonspace, nontab characters
separated by tabs or spaces, or both, from adjacent data on the same line. Equivalent to
-f elds. (Obsolescent)
+number Skips over the rst number characters. Fields specied by number are skipped before
characters. Equivalent to -s characters. (Obsolescent)
DESCRIPTION
The input_le and output_le arguments must specify different les.
Repeated lines must be on consecutive lines to be found. You can arrange them with the sort
command before processing.
934 Hewlett-Packard Company 527188-007