date and time created 94/04/13 10:27:13 by eric
[unix-history] / usr / src / usr.bin / cut / cut.1
CommitLineData
374464e3
KB
1.\" Copyright (c) 1989, 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
12cf7852 3.\"
cf136d2c
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
b3553a80 7.\" %sccs.include.redist.roff%
12cf7852 8.\"
374464e3 9.\" @(#)cut.1 8.1 (Berkeley) %G%
12cf7852 10.\"
b5dc1377
CL
11.Dd
12.Dt CUT 1
b3553a80 13.Os
b5dc1377
CL
14.Sh NAME
15.Nm cut
16.Nd select portions of each line of a file
17.Sh SYNOPSIS
18.Nm cut
b3553a80 19.Fl c Ar list
b5dc1377 20.Ar
b5dc1377 21.Nm cut
b3553a80 22.Fl f Ar list
b5dc1377 23.Op Fl d Ar string
b3553a80 24.Op Fl s
b5dc1377
CL
25.Ar
26.Sh DESCRIPTION
12cf7852 27The
b5dc1377 28.Nm cut
12cf7852 29utility selects portions of each line (as specified by
b5dc1377 30.Ar list )
12cf7852 31from each
b5dc1377 32.Ar file
12cf7852
KB
33(or the standard input by default), and writes them to the
34standard output.
35The items specified by
b5dc1377 36.Ar list
12cf7852 37can be in terms of column position or in terms of fields delimited
5325ced3 38by a special character. Column numbering starts from 1.
b5dc1377
CL
39.Pp
40.Ar List
5325ced3 41is a comma or whitespace separated set of increasing numbers and/or
12cf7852 42number ranges.
b5dc1377 43Number ranges consist of a number, a dash
b3553a80 44.Pq Li \- ,
b5dc1377 45and a second number
12cf7852
KB
46and select the fields or columns from the first number to the second,
47inclusive.
48Numbers or number ranges may be preceded by a dash, which selects all
49fields or columns from 1 to the first number.
50Numbers or number ranges may be followed by a dash, which selects all
51fields or columns from the last number to the end of the line.
52Numbers and number ranges may be repeated, overlapping, and in any order.
53It is not an error to select fields or columns not present in the
54input line.
b5dc1377 55.Pp
12cf7852 56The options are as follows:
b3553a80
CL
57.Bl -tag -width Fl
58.It Fl c Ar list
12cf7852 59The
b5dc1377 60.Ar list
12cf7852 61specifies character positions.
b3553a80 62.It Fl d Ar string
bb4636fa
KB
63Use the first character of
64.Ar string
b3553a80
CL
65as the field delimiter character instead of the tab character.
66.It Fl f Ar list
12cf7852 67The
b5dc1377 68.Ar list
12cf7852
KB
69specifies fields, delimited in the input by a single tab character.
70Output fields are separated by a single tab character.
b3553a80 71.It Fl s
12cf7852
KB
72Suppresses lines with no field delimiter characters.
73Unless specified, lines with no delimiters are passed through unmodified.
b3553a80 74.El
b5dc1377
CL
75.Pp
76.Nm Cut
5325ced3 77exits 0 on success, 1 if an error occurred.
b5dc1377
CL
78.Sh SEE ALSO
79.Xr paste 1
80.Sh STANDARDS
12cf7852 81The
b5dc1377 82.Nm cut
b3553a80
CL
83utility is expected to conform to
84.St -p1003.2 .