MPE/iX Shell and Utilities Reference Manual, Vol 2
uniq(1) MPE/iX Shell and Utilities uniq(1)
NAME
uniq — display unique lines of sorted file
SYNOPSIS
uniq [–c–d–u][–f number1][–s number2][input_file [output_file]]
uniq [–cdu][–number][+number][input_file [output_file]]
DESCRIPTION
uniq manipulates lines which occur more than once in a file. The file must be sorted, since
uniq only compares adjacent lines. When you invoke this command with no options, it
writes only one copy of each line in input_file to output_file. If you do not specify input_file or
you specify –, uniq reads the standard input. If you do not specify output_file, uniq uses
the standard output.
Options
uniq accepts the following options:
–c precedes each output line with the number of times that line occurred in the input.
–d displays only lines which are repeated (one copy of each line).
–f number1
ignores the first number1 fields when comparing lines. Blanks separate fields in the
input.
–s number2
ignores the first number2 characters when comparing lines. If you specify both –s
and –f, uniq ignores the first number2 characters after the first number1 fields.
–u displays only those lines which are not repeated.
You may choose only one of the –c, –d,or–u options.
–number
equivalent to –f number (obsolescent).
+number
equivalent to –s number (obsolescent).
EXAMPLES
uniq
is a filter which prints one copy of each different line in its sorted input.
1-634 Commands and Utilities