Commit | Line | Data |
---|---|---|
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 | 27 | The |
b5dc1377 | 28 | .Nm cut |
12cf7852 | 29 | utility selects portions of each line (as specified by |
b5dc1377 | 30 | .Ar list ) |
12cf7852 | 31 | from each |
b5dc1377 | 32 | .Ar file |
12cf7852 KB |
33 | (or the standard input by default), and writes them to the |
34 | standard output. | |
35 | The items specified by | |
b5dc1377 | 36 | .Ar list |
12cf7852 | 37 | can be in terms of column position or in terms of fields delimited |
5325ced3 | 38 | by a special character. Column numbering starts from 1. |
b5dc1377 CL |
39 | .Pp |
40 | .Ar List | |
5325ced3 | 41 | is a comma or whitespace separated set of increasing numbers and/or |
12cf7852 | 42 | number ranges. |
b5dc1377 | 43 | Number ranges consist of a number, a dash |
b3553a80 | 44 | .Pq Li \- , |
b5dc1377 | 45 | and a second number |
12cf7852 KB |
46 | and select the fields or columns from the first number to the second, |
47 | inclusive. | |
48 | Numbers or number ranges may be preceded by a dash, which selects all | |
49 | fields or columns from 1 to the first number. | |
50 | Numbers or number ranges may be followed by a dash, which selects all | |
51 | fields or columns from the last number to the end of the line. | |
52 | Numbers and number ranges may be repeated, overlapping, and in any order. | |
53 | It is not an error to select fields or columns not present in the | |
54 | input line. | |
b5dc1377 | 55 | .Pp |
12cf7852 | 56 | The options are as follows: |
b3553a80 CL |
57 | .Bl -tag -width Fl |
58 | .It Fl c Ar list | |
12cf7852 | 59 | The |
b5dc1377 | 60 | .Ar list |
12cf7852 | 61 | specifies character positions. |
b3553a80 | 62 | .It Fl d Ar string |
bb4636fa KB |
63 | Use the first character of |
64 | .Ar string | |
b3553a80 CL |
65 | as the field delimiter character instead of the tab character. |
66 | .It Fl f Ar list | |
12cf7852 | 67 | The |
b5dc1377 | 68 | .Ar list |
12cf7852 KB |
69 | specifies fields, delimited in the input by a single tab character. |
70 | Output fields are separated by a single tab character. | |
b3553a80 | 71 | .It Fl s |
12cf7852 KB |
72 | Suppresses lines with no field delimiter characters. |
73 | Unless specified, lines with no delimiters are passed through unmodified. | |
b3553a80 | 74 | .El |
b5dc1377 CL |
75 | .Pp |
76 | .Nm Cut | |
5325ced3 | 77 | exits 0 on success, 1 if an error occurred. |
b5dc1377 CL |
78 | .Sh SEE ALSO |
79 | .Xr paste 1 | |
80 | .Sh STANDARDS | |
12cf7852 | 81 | The |
b5dc1377 | 82 | .Nm cut |
b3553a80 CL |
83 | utility is expected to conform to |
84 | .St -p1003.2 . |