Manual / uniq
uniq(1)
| UNIQ(1) | General Commands Manual | UNIQ(1) |
NAME
uniq - report repeated lines
SYNOPSIS
uniq [-cdu] [-f fields] [-s chars] [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. Note that repeated lines must be adjacent in order to be found; see sort(1). Input and output default to standard input and standard output.
- -u
- Print just the lines that are not repeated.
- -d
- Print one copy of just the repeated lines.
- -c
- Precede each selected line by its repeat count.
- -f fields
- Ignore this many initial fields in comparisons. A field is a string of non-space, non-tab characters with preceding blanks.
- -s chars
- Ignore this many further characters. Fields are skipped before characters.
The full original line is printed regardless of comparison skips. The -d and -u options are mutually exclusive.
FILES
/usr/man/UNIQ this page
SEE ALSO
DIAGNOSTICS
Exit status is 0 on success, 1 for file I/O failures, 2 for usage errors.
BUGS
Lines longer than 255 bytes are treated as several logical lines. An existing longer output file is not shortened; choose a new output file. Do not use the input as the output.
| September 19, 2026 | maux |