UNIQ() LOCAL UNIQ()
NAME
uniq - Report or filter out repeated lines in a file.
SYNOPSIS
uniq [-c | -d | -u] [-f fields] [-s chars] [input_file [output_file]]
Deprecated Version:
uniq [-cdu] [-n] [+n] [input_file [output_file]]
DESCRIPTION
The uniq utility reads an input file or the standard input comparing
adjacent lines, and writes one copy of each input line on the output.
The second and succeeding copies of repeated adjacent input lines are not
written. Repeated lines in the input are not detected if they are not
adjacent, so it is important to sort(1) the files first.
The following options are available:
-c Precede each output line with a count of the number of times the
line occurred in the input. For example:
duplicate_count line_number
where the duplicate count is a blank padded field of up to four
digits followed by a space.
-d Suppress the writing of lines that are not repeated in the input.
-f fields
Ignore the first fields on each input line when doing
comparisons, where fields is a positive decimal integer. A field
is a string of non-blank characters separated from adjacent
fields by blanks.
-s chars
Ignore the first chars characters when doing comparisons, where
chars is a positive decimal integer. If specified in conjunction
with the -f option, the first chars characters after the first
fields fields will be ignored.
-u Suppress the writing of lines that are repeated in the input.
-n (Deprecated; replaced by -f). Ignore the first n fields on each
input line when doing comparisons, where n is a number. A field
is a string of non-blank characters separated from adjacent
fields by blanks.
+n (Deprecated; replaced by -s). Ignore the first m characters when
doing comparisons, where m is a number.
The following operands are available:
input_file A pathname of the input file. If the input_file operand is
not specified, the standard input is used.
output_file A pathname of the output file. This name shall always be
different from input_file. If the output_file operand is
not specified, the standard output is used. If output_file
is created and an error occurs or a sugnal is caught the
output_file is not removed.
The uniq utility exits 0 on success, and >0 if an error occurs.
STANDARDS
The uniq utility is expected to be IEEE Std1003.2 (``POSIX'') compatible.
BSD Experimental June 27, 1991 2