don't bother resolving onbld python module deps
[unleashed.git] / bin / cut / cut.1
blob6b201e8e185c5d005a6449f5f98343b430c9955f
1 .\"     $OpenBSD: cut.1,v 1.27 2016/10/24 13:46:58 schwarze Exp $
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. Neither the name of the University nor the names of its contributors
19 .\"    may be used to endorse or promote products derived from this software
20 .\"    without specific prior written permission.
21 .\"
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\"     @(#)cut.1       8.1 (Berkeley) 6/6/93
35 .\"
36 .Dd $Mdocdate: October 24 2016 $
37 .Dt CUT 1
38 .Os
39 .Sh NAME
40 .Nm cut
41 .Nd select portions of each line of a file
42 .Sh SYNOPSIS
43 .Nm cut
44 .Fl b Ar list
45 .Op Fl n
46 .Op Ar
47 .Nm cut
48 .Fl c Ar list
49 .Op Ar
50 .Nm cut
51 .Fl f Ar list
52 .Op Fl s
53 .Op Fl d Ar delim
54 .Op Ar
55 .Sh DESCRIPTION
56 The
57 .Nm
58 utility selects portions of each line (as specified by
59 .Ar list )
60 from each
61 .Ar file
62 and writes them to the standard output.
63 If no
64 .Ar file
65 arguments are specified, or a file argument is a single dash
66 .Pq Sq \- ,
67 .Nm
68 reads from the standard input.
69 The items specified by
70 .Ar list
71 can be in terms of column position or in terms of fields delimited
72 by a special character.
73 Column and field numbering starts from 1;
74 output is in the same order as input, not in the order selected.
75 .Pp
76 .Ar list
77 is a comma or whitespace separated set of numbers and/or
78 number ranges.
79 Number ranges consist of a number, a dash
80 .Pq Sq \- ,
81 and a second number
82 which select the fields or columns from the first number to the second,
83 inclusive.
84 Numbers or number ranges may be preceded by a dash, which selects all
85 fields or columns from 1 to the first number.
86 Numbers or number ranges may be followed by a dash, which selects all
87 fields or columns from the last number to the end of the line.
88 Numbers and number ranges may be repeated, overlapping, and in any order.
89 It is not an error to select fields or columns not present in the
90 input line.
91 .Pp
92 The options are as follows:
93 .Bl -tag -width Ds
94 .It Fl b Ar list
95 The
96 .Ar list
97 specifies byte positions.
98 .It Fl c Ar list
99 The
100 .Ar list
101 specifies character positions.
102 .It Fl d Ar delim
103 Use the first character of
104 .Ar delim
105 as the field delimiter character.
106 The default is the
107 .Aq TAB
108 character.
109 .It Fl f Ar list
111 .Ar list
112 specifies fields, separated by the field delimiter character.
113 The selected fields are output,
114 separated by the field delimiter character.
115 .It Fl n
116 Do not split multi-byte characters.
117 A character is written to standard output if and only if the byte
118 position holding its last byte is selected.
119 .It Fl s
120 Suppresses lines with no field delimiter characters.
121 Unless specified, lines with no delimiters are passed through unmodified.
123 .Sh ENVIRONMENT
124 .Bl -tag -width LC_CTYPE
125 .It Ev LC_CTYPE
126 The character encoding
127 .Xr locale 1 .
128 It decides which byte sequences form characters.
129 If unset or set to
130 .Qq C ,
131 .Qq POSIX ,
132 or an unsupported value,
133 .Fl c
134 does the same as
135 .Fl b ,
136 .Fl n
137 has no effect, and
138 .Fl d
139 uses the first byte of
140 .Ar delim .
142 .Sh EXIT STATUS
145 utility exits 0 if all input files are output successfully,
146 and >0 if an error occurs.
147 .Sh EXAMPLES
148 Extract login names and shells from the system
149 .Xr passwd 5
150 file as
151 .Dq name:shell
152 pairs:
154 .Dl "$ cut -d : -f 1,7 /etc/passwd"
156 Show the names and login times of logged in users:
158 .Dl "$ who | cut -c 1-8,18-30"
159 .Sh SEE ALSO
160 .Xr awk 1 ,
161 .Xr paste 1
162 .Sh STANDARDS
165 utility is compliant with the
166 .St -p1003.1-2008
167 specification.