Annotation of src/usr.bin/cut/cut.1, Revision 1.7
1.7 ! aaron 1: .\" $OpenBSD: cut.1,v 1.6 2000/03/05 20:09:21 aaron 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
1.5 aaron 61: .Nm
1.1 deraadt 62: utility selects portions of each line (as specified by
1.6 aaron 63: .Ar list )
1.1 deraadt 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
1.6 aaron 71: by a special character.
72: Column numbering starts from 1.
1.1 deraadt 73: .Pp
1.3 aaron 74: .Ar list
1.1 deraadt 75: is a comma or whitespace separated set of increasing numbers and/or
76: number ranges.
77: Number ranges consist of a number, a dash
1.3 aaron 78: .Pq Sq \- ,
1.1 deraadt 79: and a second number
1.6 aaron 80: which select the fields or columns from the first number to the second,
1.1 deraadt 81: inclusive.
82: Numbers or number ranges may be preceded by a dash, which selects all
83: fields or columns from 1 to the first number.
84: Numbers or number ranges may be followed by a dash, which selects all
85: fields or columns from the last number to the end of the line.
86: Numbers and number ranges may be repeated, overlapping, and in any order.
87: It is not an error to select fields or columns not present in the
88: input line.
89: .Pp
90: The options are as follows:
1.7 ! aaron 91: .Bl -tag -width Ds
1.1 deraadt 92: .It Fl b Ar list
1.4 aaron 93: The
1.1 deraadt 94: .Ar list
95: specifies byte positions.
96: .It Fl c Ar list
97: The
98: .Ar list
99: specifies character positions.
100: .It Fl d Ar string
101: Use the first character of
102: .Ar string
103: as the field delimiter character instead of the tab character.
104: .It Fl f Ar list
105: The
106: .Ar list
107: specifies fields, delimited in the input by a single tab character.
108: Output fields are separated by a single tab character.
109: .It Fl n
110: Do not split multi-byte characters.
111: .It Fl s
112: Suppresses lines with no field delimiter characters.
113: Unless specified, lines with no delimiters are passed through unmodified.
114: .El
115: .Pp
1.3 aaron 116: The
1.5 aaron 117: .Nm
1.3 aaron 118: utility exits 0 on success or 1 if an error occurred.
1.1 deraadt 119: .Sh SEE ALSO
120: .Xr paste 1
121: .Sh STANDARDS
122: The
1.5 aaron 123: .Nm
1.1 deraadt 124: utility conforms to
125: .St -p1003.2-92 .