Commit | Line | Data |
---|---|---|
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 | |
21 | cut - select portions of each line of a file | |
22 | .SH SYNOPSIS | |
23 | .nf | |
24 | cut -c list [file ...] | |
25 | cut -f list [-s] [-d string] [file ...] | |
26 | .fi | |
27 | .SH DESCRIPTION | |
28 | The | |
29 | .I cut | |
30 | utility selects portions of each line (as specified by | |
31 | .IR list ) | |
32 | from each | |
33 | .I file | |
34 | (or the standard input by default), and writes them to the | |
35 | standard output. | |
36 | The items specified by | |
37 | .I list | |
38 | can be in terms of column position or in terms of fields delimited | |
39 | by a special character. | |
40 | .PP | |
41 | .I List | |
42 | is a comma or whitespace separated set of one-based numbers and/or | |
43 | number ranges. | |
44 | Number ranges consist of a number, a dash (``-''), and a second number | |
45 | and select the fields or columns from the first number to the second, | |
46 | inclusive. | |
47 | Numbers or number ranges may be preceded by a dash, which selects all | |
48 | fields or columns from 1 to the first number. | |
49 | Numbers or number ranges may be followed by a dash, which selects all | |
50 | fields or columns from the last number to the end of the line. | |
51 | Numbers and number ranges may be repeated, overlapping, and in any order. | |
52 | It is not an error to select fields or columns not present in the | |
53 | input line. | |
54 | .PP | |
55 | The options are as follows: | |
56 | .TP | |
57 | -c list | |
58 | The | |
59 | .I list | |
60 | specifies character positions. | |
61 | .TP | |
62 | -f list | |
63 | The | |
64 | .I list | |
65 | specifies fields, delimited in the input by a single tab character. | |
66 | Output fields are separated by a single tab character. | |
67 | .TP | |
68 | -d char | |
69 | Use | |
70 | .I char | |
71 | as the field delimiter character instead of the tab character. | |
72 | .TP | |
73 | -s | |
74 | Suppresses lines with no field delimiter characters. | |
75 | Unless specified, lines with no delimiters are passed through unmodified. | |
76 | .PP | |
77 | .I Cut | |
78 | exit 0 on success, 1 if an error occurred. | |
79 | .SH ENVIRONMENT | |
80 | .SH "SEE ALSO" | |
81 | paste(1) | |
82 | .SH STANDARDS | |
83 | The | |
84 | .I cut | |
85 | function is expected to be POSIX 1003.2 compatible. |