BSD 3 development
[unix-history] / usr / man / man1 / uniq.1
CommitLineData
e6817382
BJ
1.TH UNIQ 1
2.SH NAME
3uniq \- report repeated lines in a file
4.SH SYNOPSIS
5.B uniq
6[
7.B \-udc
8[
9.BR + n
10] [
11.BR \- n
12]
13] [ input [ output ] ]
14.SH DESCRIPTION
15.I Uniq
16reads the input
17file comparing adjacent lines.
18In the normal case, the second and succeeding copies
19of repeated lines are
20removed; the remainder is written on the output file.
21Note that repeated lines must be adjacent
22in order to be found;
23see
24.IR sort (1).
25If the
26.B \-u
27flag is used,
28just the lines that are not repeated
29in the original file are output.
30The
31.B \-d
32option specifies that
33one copy of just the repeated lines is to
34be written.
35The normal mode output is the union of the
36.B \-u
37and
38.B \-d
39mode outputs.
40.PP
41The
42.B \-c
43option supersedes
44.B \-u
45and
46.B \-d
47and generates
48an output report in default style
49but with each line preceded by a count of the
50number of times it occurred.
51.PP
52The
53.I n
54arguments specify skipping an initial portion of each line
55in the comparison:
56.TP 8
57.BI \- n
58The first
59.IR n
60fields
61together with any blanks before each are ignored.
62A field is defined as a string of non-space, non-tab characters
63separated by tabs and spaces from its neighbors.
64.TP 8
65.BI + n
66The first
67.IR n
68characters are ignored.
69Fields are skipped before characters.
70.PP
71.SH "SEE ALSO"
72sort(1), comm(1)