uniq(1)


uniq -- report repeated lines in a file

Synopsis

uniq [-ffields] [-schars] [-cdu] [input [output]]

uniq [+n] [-n] [-cdu] [input [output]]

Description

uniq reads the input file and compares adjacent lines. By default, 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: Repeated lines must be adjacent in order to be found; see sort(1).

uniq processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(5)).

uniq takes the following options:


-u
Output only the lines that are not repeated in the original file.

-d
Output one copy of just the repeated lines. The default output is the union of the -u and -d outputs.

-c
Generate the default output but with each line preceded by a count of the number of times it occurred. The -c option supersedes -u and -d.

The following options specify skipping an initial portion of each line in the comparison:


-ffields
Ignore the first fields fields together with any blanks before each field. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. If fields specifies a field that is not present in the input line, it is treated as a null string.

-schars
Ignore the first chars characters. Fields are skipped before characters. If chars specifies more characters than are on the input line, the missing characters are treated as a null string.

+n
(Obsolescent.) Same as ``-s n''.

-n
(Obsolescent.) Same as ``-f n''.

Files


/usr/lib/locale/locale/LC_MESSAGES/uxdfm
language-specific message file (see LANG on environ(5)).

References

comm(1), sort(1)

Notices

+n and -n may not be supported in future releases. Their use is discouraged.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004