1*0f816dd2Swiz.\" $NetBSD: cut.1,v 1.18 2012/06/20 17:53:19 wiz Exp $ 2843a1dd6Sglass.\" 3843a1dd6Sglass.\" Copyright (c) 1989, 1990, 1993 4843a1dd6Sglass.\" The Regents of the University of California. All rights reserved. 561f28255Scgd.\" 661f28255Scgd.\" This code is derived from software contributed to Berkeley by 761f28255Scgd.\" the Institute of Electrical and Electronics Engineers, Inc. 861f28255Scgd.\" 961f28255Scgd.\" Redistribution and use in source and binary forms, with or without 1061f28255Scgd.\" modification, are permitted provided that the following conditions 1161f28255Scgd.\" are met: 1261f28255Scgd.\" 1. Redistributions of source code must retain the above copyright 1361f28255Scgd.\" notice, this list of conditions and the following disclaimer. 1461f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 1561f28255Scgd.\" notice, this list of conditions and the following disclaimer in the 1661f28255Scgd.\" documentation and/or other materials provided with the distribution. 1789aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors 1861f28255Scgd.\" may be used to endorse or promote products derived from this software 1961f28255Scgd.\" without specific prior written permission. 2061f28255Scgd.\" 2161f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2261f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2361f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2461f28255Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2561f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2661f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2761f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2861f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2961f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3061f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3161f28255Scgd.\" SUCH DAMAGE. 3261f28255Scgd.\" 33843a1dd6Sglass.\" @(#)cut.1 8.1 (Berkeley) 6/6/93 3461f28255Scgd.\" 35*0f816dd2Swiz.Dd June 12, 2012 3661f28255Scgd.Dt CUT 1 3761f28255Scgd.Os 3861f28255Scgd.Sh NAME 3961f28255Scgd.Nm cut 4061f28255Scgd.Nd select portions of each line of a file 4161f28255Scgd.Sh SYNOPSIS 42263324f1Slukem.Nm 432ea901d3Sjtc.Fl b Ar list 442ea901d3Sjtc.Op Fl n 452ea901d3Sjtc.Op Ar 46990562bfSwiz.Nm 4761f28255Scgd.Fl c Ar list 482ea901d3Sjtc.Op Ar 49990562bfSwiz.Nm 5061f28255Scgd.Fl f Ar list 51*0f816dd2Swiz.Op Fl d Ar string 5261f28255Scgd.Op Fl s 532ea901d3Sjtc.Op Ar 5461f28255Scgd.Sh DESCRIPTION 5561f28255ScgdThe 56263324f1Slukem.Nm 5761f28255Scgdutility selects portions of each line (as specified by 5861f28255Scgd.Ar list ) 5961f28255Scgdfrom each 6061f28255Scgd.Ar file 61d0801ba7Sjnemethand writes them to the 6261f28255Scgdstandard output. 63d0801ba7SjnemethIf the 64d0801ba7Sjnemeth.Ar file 65d0801ba7Sjnemethargument is a single dash 66f514ab02Sjnemeth.Pq Sq - 67d0801ba7Sjnemethor no 68d0801ba7Sjnemeth.Ar file 69d0801ba7Sjnemetharguments were specified, lines are read from the standard input. 7061f28255ScgdThe items specified by 7161f28255Scgd.Ar list 7261f28255Scgdcan be in terms of column position or in terms of fields delimited 730a01a9c7Swizby a special character. 7482200bc9SwizColumn and field numbering start from 1. 7561f28255Scgd.Pp 76d25b0fe6Sdholland.Ar list 7761f28255Scgdis a comma or whitespace separated set of increasing numbers and/or 7861f28255Scgdnumber ranges. 7961f28255ScgdNumber ranges consist of a number, a dash 8061f28255Scgd.Pq Li \- , 8161f28255Scgdand a second number 8282200bc9Swizand select the columns or fields from the first number to the second, 8361f28255Scgdinclusive. 8461f28255ScgdNumbers or number ranges may be preceded by a dash, which selects all 8582200bc9Swizcolumns or fields from 1 to the first number. 8661f28255ScgdNumbers or number ranges may be followed by a dash, which selects all 8782200bc9Swizcolumns or fields from the last number to the end of the line. 8861f28255ScgdNumbers and number ranges may be repeated, overlapping, and in any order. 8982200bc9SwizIt is not an error to select columns or fields not present in the 9061f28255Scgdinput line. 9161f28255Scgd.Pp 9261f28255ScgdThe options are as follows: 9361f28255Scgd.Bl -tag -width Fl 942ea901d3Sjtc.It Fl b Ar list 952ea901d3Sjtc.Ar list 962ea901d3Sjtcspecifies byte positions. 9761f28255Scgd.It Fl c Ar list 9861f28255Scgd.Ar list 9961f28255Scgdspecifies character positions. 100843a1dd6Sglass.It Fl d Ar string 101843a1dd6SglassUse the first character of 102843a1dd6Sglass.Ar string 1030a01a9c7Swizas the field delimiter character. 1040a01a9c7SwizThe default is the 1050a01a9c7Swiz.Aq TAB 1060a01a9c7Swizcharacter. 10761f28255Scgd.It Fl f Ar list 10861f28255Scgd.Ar list 1090a01a9c7Swizspecifies fields, separated by the field delimiter character. 1100a01a9c7SwizThe selected fields are output, 1110a01a9c7Swizseparated by the field delimiter character. 1122ea901d3Sjtc.It Fl n 1132ea901d3SjtcDo not split multi-byte characters. 11461f28255Scgd.It Fl s 115*0f816dd2SwizSuppress lines with no field delimiter characters. 11661f28255ScgdUnless specified, lines with no delimiters are passed through unmodified. 11761f28255Scgd.El 118e4b15274Sjmmv.Sh EXIT STATUS 119*0f816dd2Swiz.Ex -std 12061f28255Scgd.Sh SEE ALSO 12161f28255Scgd.Xr paste 1 12261f28255Scgd.Sh STANDARDS 12361f28255ScgdThe 124263324f1Slukem.Nm 1252ea901d3Sjtcutility conforms to 1260942acadSjtc.St -p1003.2-92 . 127