xref: /minix3/usr.bin/cut/cut.1 (revision d091a404e823cfd2b9b9be18cc8c1e852e55370a)
1*d091a404SThomas Cort.\"	$NetBSD: cut.1,v 1.18 2012/06/20 17:53:19 wiz Exp $
2*d091a404SThomas Cort.\"
3*d091a404SThomas Cort.\" Copyright (c) 1989, 1990, 1993
4*d091a404SThomas Cort.\"	The Regents of the University of California.  All rights reserved.
5*d091a404SThomas Cort.\"
6*d091a404SThomas Cort.\" This code is derived from software contributed to Berkeley by
7*d091a404SThomas Cort.\" the Institute of Electrical and Electronics Engineers, Inc.
8*d091a404SThomas Cort.\"
9*d091a404SThomas Cort.\" Redistribution and use in source and binary forms, with or without
10*d091a404SThomas Cort.\" modification, are permitted provided that the following conditions
11*d091a404SThomas Cort.\" are met:
12*d091a404SThomas Cort.\" 1. Redistributions of source code must retain the above copyright
13*d091a404SThomas Cort.\"    notice, this list of conditions and the following disclaimer.
14*d091a404SThomas Cort.\" 2. Redistributions in binary form must reproduce the above copyright
15*d091a404SThomas Cort.\"    notice, this list of conditions and the following disclaimer in the
16*d091a404SThomas Cort.\"    documentation and/or other materials provided with the distribution.
17*d091a404SThomas Cort.\" 3. Neither the name of the University nor the names of its contributors
18*d091a404SThomas Cort.\"    may be used to endorse or promote products derived from this software
19*d091a404SThomas Cort.\"    without specific prior written permission.
20*d091a404SThomas Cort.\"
21*d091a404SThomas Cort.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22*d091a404SThomas Cort.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*d091a404SThomas Cort.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*d091a404SThomas Cort.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25*d091a404SThomas Cort.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*d091a404SThomas Cort.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*d091a404SThomas Cort.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*d091a404SThomas Cort.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*d091a404SThomas Cort.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*d091a404SThomas Cort.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*d091a404SThomas Cort.\" SUCH DAMAGE.
32*d091a404SThomas Cort.\"
33*d091a404SThomas Cort.\"     @(#)cut.1	8.1 (Berkeley) 6/6/93
34*d091a404SThomas Cort.\"
35*d091a404SThomas Cort.Dd June 12, 2012
36*d091a404SThomas Cort.Dt CUT 1
37*d091a404SThomas Cort.Os
38*d091a404SThomas Cort.Sh NAME
39*d091a404SThomas Cort.Nm cut
40*d091a404SThomas Cort.Nd select portions of each line of a file
41*d091a404SThomas Cort.Sh SYNOPSIS
42*d091a404SThomas Cort.Nm
43*d091a404SThomas Cort.Fl b Ar list
44*d091a404SThomas Cort.Op Fl n
45*d091a404SThomas Cort.Op Ar
46*d091a404SThomas Cort.Nm
47*d091a404SThomas Cort.Fl c Ar list
48*d091a404SThomas Cort.Op Ar
49*d091a404SThomas Cort.Nm
50*d091a404SThomas Cort.Fl f Ar list
51*d091a404SThomas Cort.Op Fl d Ar string
52*d091a404SThomas Cort.Op Fl s
53*d091a404SThomas Cort.Op Ar
54*d091a404SThomas Cort.Sh DESCRIPTION
55*d091a404SThomas CortThe
56*d091a404SThomas Cort.Nm
57*d091a404SThomas Cortutility selects portions of each line (as specified by
58*d091a404SThomas Cort.Ar list )
59*d091a404SThomas Cortfrom each
60*d091a404SThomas Cort.Ar file
61*d091a404SThomas Cortand writes them to the
62*d091a404SThomas Cortstandard output.
63*d091a404SThomas CortIf the
64*d091a404SThomas Cort.Ar file
65*d091a404SThomas Cortargument is a single dash
66*d091a404SThomas Cort.Pq Sq -
67*d091a404SThomas Cortor no
68*d091a404SThomas Cort.Ar file
69*d091a404SThomas Cortarguments were specified, lines are read from the standard input.
70*d091a404SThomas CortThe items specified by
71*d091a404SThomas Cort.Ar list
72*d091a404SThomas Cortcan be in terms of column position or in terms of fields delimited
73*d091a404SThomas Cortby a special character.
74*d091a404SThomas CortColumn and field numbering start from 1.
75*d091a404SThomas Cort.Pp
76*d091a404SThomas Cort.Ar list
77*d091a404SThomas Cortis a comma or whitespace separated set of increasing numbers and/or
78*d091a404SThomas Cortnumber ranges.
79*d091a404SThomas CortNumber ranges consist of a number, a dash
80*d091a404SThomas Cort.Pq Li \- ,
81*d091a404SThomas Cortand a second number
82*d091a404SThomas Cortand select the columns or fields from the first number to the second,
83*d091a404SThomas Cortinclusive.
84*d091a404SThomas CortNumbers or number ranges may be preceded by a dash, which selects all
85*d091a404SThomas Cortcolumns or fields from 1 to the first number.
86*d091a404SThomas CortNumbers or number ranges may be followed by a dash, which selects all
87*d091a404SThomas Cortcolumns or fields from the last number to the end of the line.
88*d091a404SThomas CortNumbers and number ranges may be repeated, overlapping, and in any order.
89*d091a404SThomas CortIt is not an error to select columns or fields not present in the
90*d091a404SThomas Cortinput line.
91*d091a404SThomas Cort.Pp
92*d091a404SThomas CortThe options are as follows:
93*d091a404SThomas Cort.Bl -tag -width Fl
94*d091a404SThomas Cort.It Fl b Ar list
95*d091a404SThomas Cort.Ar list
96*d091a404SThomas Cortspecifies byte positions.
97*d091a404SThomas Cort.It Fl c Ar list
98*d091a404SThomas Cort.Ar list
99*d091a404SThomas Cortspecifies character positions.
100*d091a404SThomas Cort.It Fl d Ar string
101*d091a404SThomas CortUse the first character of
102*d091a404SThomas Cort.Ar string
103*d091a404SThomas Cortas the field delimiter character.
104*d091a404SThomas CortThe default is the
105*d091a404SThomas Cort.Aq TAB
106*d091a404SThomas Cortcharacter.
107*d091a404SThomas Cort.It Fl f Ar list
108*d091a404SThomas Cort.Ar list
109*d091a404SThomas Cortspecifies fields, separated by the field delimiter character.
110*d091a404SThomas CortThe selected fields are output,
111*d091a404SThomas Cortseparated by the field delimiter character.
112*d091a404SThomas Cort.It Fl n
113*d091a404SThomas CortDo not split multi-byte characters.
114*d091a404SThomas Cort.It Fl s
115*d091a404SThomas CortSuppress lines with no field delimiter characters.
116*d091a404SThomas CortUnless specified, lines with no delimiters are passed through unmodified.
117*d091a404SThomas Cort.El
118*d091a404SThomas Cort.Sh EXIT STATUS
119*d091a404SThomas Cort.Ex -std
120*d091a404SThomas Cort.Sh SEE ALSO
121*d091a404SThomas Cort.Xr paste 1
122*d091a404SThomas Cort.Sh STANDARDS
123*d091a404SThomas CortThe
124*d091a404SThomas Cort.Nm
125*d091a404SThomas Cortutility conforms to
126*d091a404SThomas Cort.St -p1003.2-92 .
127