1 .\" $NetBSD: cut.1,v 1.15 2008/12/21 18:13:07 wiz Exp $
3 .\" Copyright (c) 1989, 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)cut.1 8.1 (Berkeley) 6/6/93
40 .Nd select portions of each line of a file
57 utility selects portions of each line (as specified by
61 and writes them to the
65 argument is a single dash
69 arguments were specified, lines are read from the standard input.
70 The items specified by
72 can be in terms of column position or in terms of fields delimited
73 by a special character.
74 Column numbering starts from 1.
77 is a comma or whitespace separated set of increasing numbers and/or
79 Number ranges consist of a number, a dash
82 and select the fields or columns from the first number to the second,
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
92 The options are as follows:
97 specifies byte positions.
101 specifies character positions.
103 Use the first character of
105 as the field delimiter character.
112 specifies fields, separated by the field delimiter character.
113 The selected fields are output,
114 separated by the field delimiter character.
116 Do not split multi-byte characters.
118 Suppresses lines with no field delimiter characters.
119 Unless specified, lines with no delimiters are passed through unmodified.
123 exits 0 on success, 1 if an error occurred.