Annotation of src/usr.bin/uniq/uniq.1, Revision 1.5
1.5 ! aaron 1: .\" $OpenBSD: uniq.1,v 1.4 2000/03/05 00:28:56 aaron Exp $
1.1 deraadt 2: .\" $NetBSD: uniq.1,v 1.5 1994/12/06 07:51:15 jtc Exp $
3: .\"
4: .\" Copyright (c) 1991, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the University of
21: .\" California, Berkeley and its contributors.
22: .\" 4. Neither the name of the University nor the names of its contributors
23: .\" may be used to endorse or promote products derived from this software
24: .\" without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: .\" SUCH DAMAGE.
37: .\"
38: .\" @(#)uniq.1 8.1 (Berkeley) 6/6/93
39: .\"
40: .Dd June 6, 1993
41: .Dt UNIQ 1
42: .Os
43: .Sh NAME
44: .Nm uniq
45: .Nd report or filter out repeated lines in a file
46: .Sh SYNOPSIS
47: .Nm uniq
48: .Op Fl c | Fl d | Fl u
49: .Op Fl f Ar fields
50: .Op Fl s Ar chars
51: .Oo
52: .Ar input_file
53: .Op Ar output_file
54: .Oc
55: .Sh DESCRIPTION
56: The
1.5 ! aaron 57: .Nm
1.3 aaron 58: utility reads the standard input comparing adjacent lines and writes
1.1 deraadt 59: a copy of each unique input line to the standard output.
60: The second and succeeding copies of identical adjacent input lines are
61: not written.
62: Repeated lines in the input will not be detected if they are not adjacent,
63: so it may be necessary to sort the files first.
64: .Pp
1.4 aaron 65: The options are as follows:
1.1 deraadt 66: .Bl -tag -width Ds
67: .It Fl c
68: Precede each output line with the count of the number of times the line
69: occurred in the input, followed by a single space.
70: .It Fl d
71: Don't output lines that are not repeated in the input.
72: .It Fl f Ar fields
73: Ignore the first
74: .Ar fields
75: in each input line when doing comparisons.
76: A field is a string of non-blank characters separated from adjacent fields
77: by blanks.
1.5 ! aaron 78: Field numbers are one based, i.e., the first field is field one.
1.1 deraadt 79: .It Fl s Ar chars
80: Ignore the first
81: .Ar chars
82: characters in each input line when doing comparisons.
83: If specified in conjunction with the
84: .Fl f
85: option, the first
86: .Ar chars
87: characters after the first
88: .Ar fields
89: fields will be ignored.
1.5 ! aaron 90: Character numbers are one based, i.e., the first character is character one.
1.1 deraadt 91: .It Fl u
92: Don't output lines that are repeated in the input.
93: .\".It Fl Ns Ar n
94: .\"(Deprecated; replaced by
95: .\".Fl f ) .
96: .\"Ignore the first n
97: .\"fields on each input line when doing comparisons,
98: .\"where n is a number.
99: .\"A field is a string of non-blank
100: .\"characters separated from adjacent fields
101: .\"by blanks.
102: .\".It Cm \&\(pl Ns Ar n
103: .\"(Deprecated; replaced by
104: .\".Fl s ) .
105: .\"Ignore the first
106: .\".Ar m
107: .\"characters when doing comparisons, where
108: .\".Ar m
109: .\"is a
110: .\"number.
111: .El
112: .Pp
113: If additional arguments are specified on the command line, the first
114: such argument is used as the name of an input file, the second is used
115: as the name of an output file.
116: .Pp
117: The
1.5 ! aaron 118: .Nm
1.3 aaron 119: utility exits 0 on success or >0 if an error occurred.
1.5 ! aaron 120: .Sh SEE ALSO
! 121: .Xr sort 1
1.1 deraadt 122: .Sh COMPATIBILITY
123: The historic
124: .Cm \&\(pl Ns Ar number
125: and
126: .Fl Ns Ar number
127: options have been deprecated but are still supported in this implementation.
128: .Sh STANDARDS
129: The
1.5 ! aaron 130: .Nm
1.1 deraadt 131: utility is expected to be
132: .St -p1003.2
133: compatible.