date and time created 89/12/25 12:01:12 by bostic
[unix-history] / usr / src / usr.bin / cut / cut.1
CommitLineData
12cf7852
KB
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
16.\" @(#)cut.1 5.1 (Berkeley) %G%
17.\"
18.TH CUT 1 ""
19.UC 7
20.SH NAME
21cut - select portions of each line of a file
22.SH SYNOPSIS
23.nf
24cut -c list [file ...]
25cut -f list [-s] [-d string] [file ...]
26.fi
27.SH DESCRIPTION
28The
29.I cut
30utility selects portions of each line (as specified by
31.IR list )
32from each
33.I file
34(or the standard input by default), and writes them to the
35standard output.
36The items specified by
37.I list
38can be in terms of column position or in terms of fields delimited
39by a special character.
40.PP
41.I List
42is a comma or whitespace separated set of one-based numbers and/or
43number ranges.
44Number ranges consist of a number, a dash (``-''), and a second number
45and select the fields or columns from the first number to the second,
46inclusive.
47Numbers or number ranges may be preceded by a dash, which selects all
48fields or columns from 1 to the first number.
49Numbers or number ranges may be followed by a dash, which selects all
50fields or columns from the last number to the end of the line.
51Numbers and number ranges may be repeated, overlapping, and in any order.
52It is not an error to select fields or columns not present in the
53input line.
54.PP
55The options are as follows:
56.TP
57-c list
58The
59.I list
60specifies character positions.
61.TP
62-f list
63The
64.I list
65specifies fields, delimited in the input by a single tab character.
66Output fields are separated by a single tab character.
67.TP
68-d char
69Use
70.I char
71as the field delimiter character instead of the tab character.
72.TP
73-s
74Suppresses lines with no field delimiter characters.
75Unless specified, lines with no delimiters are passed through unmodified.
76.PP
77.I Cut
78exit 0 on success, 1 if an error occurred.
79.SH ENVIRONMENT
80.SH "SEE ALSO"
81paste(1)
82.SH STANDARDS
83The
84.I cut
85function is expected to be POSIX 1003.2 compatible.