19b50d902SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 69b50d902SRodney W. Grimes.\" 79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 99b50d902SRodney W. Grimes.\" are met: 109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 119b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 139b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 149b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 169b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 179b50d902SRodney W. Grimes.\" without specific prior written permission. 189b50d902SRodney W. Grimes.\" 199b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 209b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 219b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 229b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 239b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 249b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 259b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 269b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 279b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 289b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 299b50d902SRodney W. Grimes.\" SUCH DAMAGE. 309b50d902SRodney W. Grimes.\" 31*9bdb5158SGordon Bergling.Dd November 6, 2022 329b50d902SRodney W. Grimes.Dt CUT 1 339b50d902SRodney W. Grimes.Os 349b50d902SRodney W. Grimes.Sh NAME 359b50d902SRodney W. Grimes.Nm cut 36081fa92fSRuslan Ermilov.Nd cut out selected portions of each line of a file 379b50d902SRodney W. Grimes.Sh SYNOPSIS 388fe908efSRuslan Ermilov.Nm 39d51c6625SEivind Eklund.Fl b Ar list 40d51c6625SEivind Eklund.Op Fl n 41d51c6625SEivind Eklund.Op Ar 428fe908efSRuslan Ermilov.Nm 439b50d902SRodney W. Grimes.Fl c Ar list 44d51c6625SEivind Eklund.Op Ar 458fe908efSRuslan Ermilov.Nm 469b50d902SRodney W. Grimes.Fl f Ar list 4718ba28c8SEitan Adler.Op Fl w | Fl d Ar delim 489b50d902SRodney W. Grimes.Op Fl s 49d51c6625SEivind Eklund.Op Ar 509b50d902SRodney W. Grimes.Sh DESCRIPTION 519b50d902SRodney W. GrimesThe 528fe908efSRuslan Ermilov.Nm 53081fa92fSRuslan Ermilovutility cuts out selected portions of each line (as specified by 549b50d902SRodney W. Grimes.Ar list ) 559b50d902SRodney W. Grimesfrom each 569b50d902SRodney W. Grimes.Ar file 57a38d3fb3STom Rhodesand writes them to the standard output. 58a38d3fb3STom RhodesIf no 59a38d3fb3STom Rhodes.Ar file 60a38d3fb3STom Rhodesarguments are specified, or a file argument is a single dash 61a38d3fb3STom Rhodes.Pq Sq Fl , 62a38d3fb3STom Rhodes.Nm 63b9e09bb6SGiorgos Keramidasreads from the standard input. 649b50d902SRodney W. GrimesThe items specified by 659b50d902SRodney W. Grimes.Ar list 669b50d902SRodney W. Grimescan be in terms of column position or in terms of fields delimited 6787faa07bSSheldon Hearnby a special character. 680087e181SKevin LoColumn and field numbering start from 1. 699b50d902SRodney W. Grimes.Pp 70a38d3fb3STom RhodesThe 715183fb53SEivind Eklund.Ar list 72a38d3fb3STom Rhodesoption argument 739b50d902SRodney W. Grimesis a comma or whitespace separated set of increasing numbers and/or 749b50d902SRodney W. Grimesnumber ranges. 759b50d902SRodney W. GrimesNumber ranges consist of a number, a dash 765183fb53SEivind Eklund.Pq Sq \- , 779b50d902SRodney W. Grimesand a second number 78d334b286SKevin Loand select the columns or fields from the first number to the second, 799b50d902SRodney W. Grimesinclusive. 809b50d902SRodney W. GrimesNumbers or number ranges may be preceded by a dash, which selects all 81d334b286SKevin Locolumns or fields from 1 to the last number. 829b50d902SRodney W. GrimesNumbers or number ranges may be followed by a dash, which selects all 83d334b286SKevin Locolumns or fields from the last number to the end of the line. 849b50d902SRodney W. GrimesNumbers and number ranges may be repeated, overlapping, and in any order. 85d334b286SKevin LoIt is not an error to select columns or fields not present in the 869b50d902SRodney W. Grimesinput line. 879b50d902SRodney W. Grimes.Pp 889b50d902SRodney W. GrimesThe options are as follows: 8939e21a1bSPhilippe Charnier.Bl -tag -width indent 90d51c6625SEivind Eklund.It Fl b Ar list 91d51c6625SEivind EklundThe 92d51c6625SEivind Eklund.Ar list 93d51c6625SEivind Eklundspecifies byte positions. 949b50d902SRodney W. Grimes.It Fl c Ar list 959b50d902SRodney W. GrimesThe 969b50d902SRodney W. Grimes.Ar list 979b50d902SRodney W. Grimesspecifies character positions. 98812bff99SPhilippe Charnier.It Fl d Ar delim 99a5c4bafcSTim J. RobbinsUse 100812bff99SPhilippe Charnier.Ar delim 1019b50d902SRodney W. Grimesas the field delimiter character instead of the tab character. 1029b50d902SRodney W. Grimes.It Fl f Ar list 1039b50d902SRodney W. GrimesThe 1049b50d902SRodney W. Grimes.Ar list 1058180b457STim J. Robbinsspecifies fields, separated in the input by the field delimiter character 1068180b457STim J. Robbins(see the 1078180b457STim J. Robbins.Fl d 1086abf213bSTom Rhodesoption). 1098180b457STim J. RobbinsOutput fields are separated by a single occurrence of the field delimiter 1108180b457STim J. Robbinscharacter. 111d51c6625SEivind Eklund.It Fl n 112d51c6625SEivind EklundDo not split multi-byte characters. 113ea8348d4STim J. RobbinsCharacters will only be output if at least one byte is selected, and, 114ea8348d4STim J. Robbinsafter a prefix of zero or more unselected bytes, the rest of the bytes 115ea8348d4STim J. Robbinsthat form the character are selected. 1169b50d902SRodney W. Grimes.It Fl s 11739e21a1bSPhilippe CharnierSuppress lines with no field delimiter characters. 1189b50d902SRodney W. GrimesUnless specified, lines with no delimiters are passed through unmodified. 11918ba28c8SEitan Adler.It Fl w 12018ba28c8SEitan AdlerUse whitespace (spaces and tabs) as the delimiter. 12118ba28c8SEitan AdlerConsecutive spaces and tabs count as one single field separator. 1229b50d902SRodney W. Grimes.El 123393cf508STim J. Robbins.Sh ENVIRONMENT 124393cf508STim J. RobbinsThe 125792c362fSRuslan Ermilov.Ev LANG , LC_ALL 126393cf508STim J. Robbinsand 127393cf508STim J. Robbins.Ev LC_CTYPE 128081fa92fSRuslan Ermilovenvironment variables affect the execution of 129393cf508STim J. Robbins.Nm 130081fa92fSRuslan Ermilovas described in 131393cf508STim J. Robbins.Xr environ 7 . 1326c7216dfSRuslan Ermilov.Sh EXIT STATUS 1336c7216dfSRuslan Ermilov.Ex -std 134500b4b73STim J. Robbins.Sh EXAMPLES 135500b4b73STim J. RobbinsExtract users' login names and shells from the system 136500b4b73STim J. Robbins.Xr passwd 5 137500b4b73STim J. Robbinsfile as 138500b4b73STim J. Robbins.Dq name:shell 139500b4b73STim J. Robbinspairs: 140500b4b73STim J. Robbins.Pp 141500b4b73STim J. Robbins.Dl "cut -d : -f 1,7 /etc/passwd" 142500b4b73STim J. Robbins.Pp 143500b4b73STim J. RobbinsShow the names and login times of the currently logged in users: 144500b4b73STim J. Robbins.Pp 145500b4b73STim J. Robbins.Dl "who | cut -c 1-16,26-38" 1469b50d902SRodney W. Grimes.Sh SEE ALSO 147f91650cfSTim J. Robbins.Xr colrm 1 , 1489b50d902SRodney W. Grimes.Xr paste 1 1499b50d902SRodney W. Grimes.Sh STANDARDS 1509b50d902SRodney W. GrimesThe 1518fe908efSRuslan Ermilov.Nm 152d51c6625SEivind Eklundutility conforms to 153d51c6625SEivind Eklund.St -p1003.2-92 . 154079f5b9bSSevan Janiyan.Pp 155079f5b9bSSevan JaniyanThe 156079f5b9bSSevan Janiyan.Fl w 157079f5b9bSSevan Janiyanflag is an extension to the specification. 15884fb5a42STim J. Robbins.Sh HISTORY 15984fb5a42STim J. RobbinsA 16084fb5a42STim J. Robbins.Nm 161*9bdb5158SGordon Berglingcommand first appeared in 162*9bdb5158SGordon Bergling.Bx 4.3 Reno . 163*9bdb5158SGordon Bergling.Sh AUTHORS 164*9bdb5158SGordon Bergling.An -nosplit 165*9bdb5158SGordon BerglingThe original Bell Labs version was written by 166*9bdb5158SGordon Bergling.An Gottfried W. R. Luderer 167*9bdb5158SGordon Berglingand the 168*9bdb5158SGordon Bergling.Bx 169*9bdb5158SGordon Berglingversion by 170*9bdb5158SGordon Bergling.An Adam S. Moskowitz . 171