BSD 4_4 development
[unix-history] / usr / share / man / cat1 / cut.0
CommitLineData
98473598
C
1CUT(1) BSD Reference Manual CUT(1)
2
3N\bNA\bAM\bME\bE
4 c\bcu\but\bt - select portions of each line of a file
5
6S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
7 c\bcu\but\bt -\b-c\bc _\bl_\bi_\bs_\bt _\bf_\bi_\bl_\be _\b._\b._\b.
8 c\bcu\but\bt -\b-f\bf _\bl_\bi_\bs_\bt [-\b-d\bd _\bs_\bt_\br_\bi_\bn_\bg] [-\b-s\bs] _\bf_\bi_\bl_\be _\b._\b._\b.
9
10D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
11 The c\bcu\but\bt utility selects portions of each line (as specified by _\bl_\bi_\bs_\bt) from
12 each _\bf_\bi_\bl_\be (or the standard input by default), and writes them to the
13 standard output. The items specified by _\bl_\bi_\bs_\bt can be in terms of column
14 position or in terms of fields delimited by a special character. Column
15 numbering starts from 1.
16
17 _\bL_\bi_\bs_\bt is a comma or whitespace separated set of increasing numbers and/or
18 number ranges. Number ranges consist of a number, a dash (-), and a sec-
19 ond number and select the fields or columns from the first number to the
20 second, inclusive. Numbers or number ranges may be preceded by a dash,
21 which selects all fields or columns from 1 to the first number. Numbers
22 or number ranges may be followed by a dash, which selects all fields or
23 columns from the last number to the end of the line. Numbers and number
24 ranges may be repeated, overlapping, and in any order. It is not an er-
25 ror to select fields or columns not present in the input line.
26
27 The options are as follows:
28
29 -\b-c\bc _\bl_\bi_\bs_\bt The _\bl_\bi_\bs_\bt specifies character positions.
30
31 -\b-d\bd _\bs_\bt_\br_\bi_\bn_\bg Use the first character of _\bs_\bt_\br_\bi_\bn_\bg as the field delimiter
32 character instead of the tab character.
33
34 -\b-f\bf _\bl_\bi_\bs_\bt The _\bl_\bi_\bs_\bt specifies fields, delimited in the input by a single
35 tab character. Output fields are separated by a single tab
36 character.
37
38 -\b-s\bs Suppresses lines with no field delimiter characters. Unless
39 specified, lines with no delimiters are passed through unmod-
40 ified.
41
42 C\bCu\but\bt exits 0 on success, 1 if an error occurred.
43
44S\bSE\bEE\bE A\bAL\bLS\bSO\bO
45 paste(1)
46
47S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
48 The c\bcu\but\bt utility is expected to conform to IEEE Std1003.2 (``POSIX'').
49
504.4BSD June 6, 1993 1