Annotation of src/usr.bin/cut/cut.1, Revision 1.2
1.2 ! deraadt 1: .\" $OpenBSD: cut.1,v 1.6 1995/10/02 20:19:26 jtc Exp $
1.1 deraadt 2: .\" $NetBSD: cut.1,v 1.6 1995/10/02 20:19:26 jtc Exp $
3: .\"
4: .\" Copyright (c) 1989, 1990, 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: .\" @(#)cut.1 8.1 (Berkeley) 6/6/93
39: .\"
40: .Dd June 6, 1993
41: .Dt CUT 1
42: .Os
43: .Sh NAME
44: .Nm cut
45: .Nd select portions of each line of a file
46: .Sh SYNOPSIS
47: .Nm cut
48: .Fl b Ar list
49: .Op Fl n
50: .Op Ar
51: .Nm cut
52: .Fl c Ar list
53: .Op Ar
54: .Nm cut
55: .Fl f Ar list
56: .Op Fl d Ar delim
57: .Op Fl s
58: .Op Ar
59: .Sh DESCRIPTION
60: The
61: .Nm cut
62: utility selects portions of each line (as specified by
63: .Ar list )
64: from each
65: .Ar file
66: (or the standard input by default), and writes them to the
67: standard output.
68: The items specified by
69: .Ar list
70: can be in terms of column position or in terms of fields delimited
71: by a special character. Column numbering starts from 1.
72: .Pp
73: .Ar List
74: is a comma or whitespace separated set of increasing numbers and/or
75: number ranges.
76: Number ranges consist of a number, a dash
77: .Pq Li \- ,
78: and a second number
79: and select the fields or columns from the first number to the second,
80: inclusive.
81: Numbers or number ranges may be preceded by a dash, which selects all
82: fields or columns from 1 to the first number.
83: Numbers or number ranges may be followed by a dash, which selects all
84: fields or columns from the last number to the end of the line.
85: Numbers and number ranges may be repeated, overlapping, and in any order.
86: It is not an error to select fields or columns not present in the
87: input line.
88: .Pp
89: The options are as follows:
90: .Bl -tag -width Fl
91: .It Fl b Ar list
92: The
93: .Ar list
94: specifies byte positions.
95: .It Fl c Ar list
96: The
97: .Ar list
98: specifies character positions.
99: .It Fl d Ar string
100: Use the first character of
101: .Ar string
102: as the field delimiter character instead of the tab character.
103: .It Fl f Ar list
104: The
105: .Ar list
106: specifies fields, delimited in the input by a single tab character.
107: Output fields are separated by a single tab character.
108: .It Fl n
109: Do not split multi-byte characters.
110: .It Fl s
111: Suppresses lines with no field delimiter characters.
112: Unless specified, lines with no delimiters are passed through unmodified.
113: .El
114: .Pp
115: .Nm Cut
116: exits 0 on success, 1 if an error occurred.
117: .Sh SEE ALSO
118: .Xr paste 1
119: .Sh STANDARDS
120: The
121: .Nm cut
122: utility conforms to
123: .St -p1003.2-92 .