uniq - report repeated lines in a file
uniq [ -u|-d|-c ] [ -f fields ] [ -s chars ] [ input [ output ] ]
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). If the -u flag is used, just the lines that are not
repeated in the original file are output. The -d option specifies that
one copy of just the repeated lines is to be written. The normal mode
output is the union of the -u and -d mode outputs. The -c option
supersedes -u and -d and generates an output report in default style but
with each line preceded by a count of the number of times it occurred.
uniq processes supplementary code set characters according to the locale
specified in the LC_CTYPE environment variable [see LANG on environ(5)].
The -f and -s options specify skipping an initial portion of each line in
The first fields fields together with any blanks preceding them
are ignored for each input line. A field is defined as a string
of non-space, non-tab characters separated by tabs and spaces
from its neighbors.
The first chars characters (columns, in multibyte environments)
are ignored. Fields are skipped before characters.
The -n and +m options, although still recognized, are now obsolete and
may not be supported in future releases. The -n option is equivalent to
-f fields with fields set to n. The +m option is equivalent to -s chars
with chars set to m.
language-specific message file [See LANG on environ(5).]
PPPPaaaaggggeeee 1111 [ Back ]