1.\" $NetBSD: cut.1,v 1.9 2001/12/01 16:43:12 wiz Exp $ 2.\" 3.\" Copyright (c) 1989, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" the Institute of Electrical and Electronics Engineers, Inc. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 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. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the University of 20.\" California, Berkeley and its contributors. 21.\" 4. Neither the name of the University nor the names of its contributors 22.\" may be used to endorse or promote products derived from this software 23.\" without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35.\" SUCH DAMAGE. 36.\" 37.\" @(#)cut.1 8.1 (Berkeley) 6/6/93 38.\" 39.Dd June 6, 1993 40.Dt CUT 1 41.Os 42.Sh NAME 43.Nm cut 44.Nd select portions of each line of a file 45.Sh SYNOPSIS 46.Nm 47.Fl b Ar list 48.Op Fl n 49.Op Ar 50.Nm "" 51.Fl c Ar list 52.Op Ar 53.Nm "" 54.Fl f Ar list 55.Op Fl d Ar delim 56.Op Fl s 57.Op Ar 58.Sh DESCRIPTION 59The 60.Nm 61utility selects portions of each line (as specified by 62.Ar list ) 63from each 64.Ar file 65(or the standard input by default), and writes them to the 66standard output. 67The items specified by 68.Ar list 69can be in terms of column position or in terms of fields delimited 70by a special character. Column numbering starts from 1. 71.Pp 72.Ar List 73is a comma or whitespace separated set of increasing numbers and/or 74number ranges. 75Number ranges consist of a number, a dash 76.Pq Li \- , 77and a second number 78and select the fields or columns from the first number to the second, 79inclusive. 80Numbers or number ranges may be preceded by a dash, which selects all 81fields or columns from 1 to the first number. 82Numbers or number ranges may be followed by a dash, which selects all 83fields or columns from the last number to the end of the line. 84Numbers and number ranges may be repeated, overlapping, and in any order. 85It is not an error to select fields or columns not present in the 86input line. 87.Pp 88The options are as follows: 89.Bl -tag -width Fl 90.It Fl b Ar list 91The 92.Ar list 93specifies byte positions. 94.It Fl c Ar list 95The 96.Ar list 97specifies character positions. 98.It Fl d Ar string 99Use the first character of 100.Ar string 101as the field delimiter character instead of the tab character. 102.It Fl f Ar list 103The 104.Ar list 105specifies fields, delimited in the input by a single tab character. 106Output fields are separated by a single tab character. 107.It Fl n 108Do not split multi-byte characters. 109.It Fl s 110Suppresses lines with no field delimiter characters. 111Unless specified, lines with no delimiters are passed through unmodified. 112.El 113.Pp 114.Nm 115exits 0 on success, 1 if an error occurred. 116.Sh SEE ALSO 117.Xr paste 1 118.Sh STANDARDS 119The 120.Nm 121utility conforms to 122.St -p1003.2-92 . 123