Commit | Line | Data |
---|---|---|
b5dc1377 | 1 | .\" Copyright (c) 1989, 1990 The Regents of the University of California. |
12cf7852 KB |
2 | .\" All rights reserved. |
3 | .\" | |
1c15e888 C |
4 | .\" Redistribution and use in source and binary forms are permitted provided |
5 | .\" that: (1) source distributions retain this entire copyright notice and | |
6 | .\" comment, and (2) distributions including binaries display the following | |
7 | .\" acknowledgement: ``This product includes software developed by the | |
8 | .\" University of California, Berkeley and its contributors'' in the | |
9 | .\" documentation or other materials provided with the distribution and in | |
10 | .\" all advertising materials mentioning features or use of this software. | |
11 | .\" Neither the name of the University nor the names of its contributors may | |
12 | .\" be used to endorse or promote products derived from this software without | |
13 | .\" specific prior written permission. | |
14 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
15 | .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
16 | .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
12cf7852 | 17 | .\" |
1c15e888 | 18 | .\" @(#)cut.1 5.3 (Berkeley) 7/24/90 |
12cf7852 | 19 | .\" |
1c15e888 | 20 | .Dd July 24, 1990 |
b5dc1377 CL |
21 | .Dt CUT 1 |
22 | .Os BSD 4.4 | |
23 | .Sh NAME | |
24 | .Nm cut | |
25 | .Nd select portions of each line of a file | |
26 | .Sh SYNOPSIS | |
27 | .Nm cut | |
28 | .Ar list | |
29 | .Ar | |
30 | .br | |
31 | .Nm cut | |
32 | .Ar list | |
33 | .Op Fl s | |
34 | .Op Fl d Ar string | |
35 | .Ar | |
36 | .Sh DESCRIPTION | |
12cf7852 | 37 | The |
b5dc1377 | 38 | .Nm cut |
12cf7852 | 39 | utility selects portions of each line (as specified by |
b5dc1377 | 40 | .Ar list ) |
12cf7852 | 41 | from each |
b5dc1377 | 42 | .Ar file |
12cf7852 KB |
43 | (or the standard input by default), and writes them to the |
44 | standard output. | |
45 | The items specified by | |
b5dc1377 | 46 | .Ar list |
12cf7852 | 47 | can be in terms of column position or in terms of fields delimited |
5325ced3 | 48 | by a special character. Column numbering starts from 1. |
b5dc1377 CL |
49 | .Pp |
50 | .Ar List | |
5325ced3 | 51 | is a comma or whitespace separated set of increasing numbers and/or |
12cf7852 | 52 | number ranges. |
b5dc1377 CL |
53 | Number ranges consist of a number, a dash |
54 | .Li (``\-'') , | |
55 | and a second number | |
12cf7852 KB |
56 | and select the fields or columns from the first number to the second, |
57 | inclusive. | |
58 | Numbers or number ranges may be preceded by a dash, which selects all | |
59 | fields or columns from 1 to the first number. | |
60 | Numbers or number ranges may be followed by a dash, which selects all | |
61 | fields or columns from the last number to the end of the line. | |
62 | Numbers and number ranges may be repeated, overlapping, and in any order. | |
63 | It is not an error to select fields or columns not present in the | |
64 | input line. | |
b5dc1377 | 65 | .Pp |
12cf7852 | 66 | The options are as follows: |
b5dc1377 CL |
67 | .Tw Fl |
68 | .Tp Cx Fl c | |
69 | .Cx \&\ \& | |
70 | .Ar list | |
71 | .Cx | |
12cf7852 | 72 | The |
b5dc1377 | 73 | .Ar list |
12cf7852 | 74 | specifies character positions. |
b5dc1377 CL |
75 | .Tp Cx Fl f |
76 | .Cx \&\ \& | |
77 | .Ar list | |
78 | .Cx | |
12cf7852 | 79 | The |
b5dc1377 | 80 | .Ar list |
12cf7852 KB |
81 | specifies fields, delimited in the input by a single tab character. |
82 | Output fields are separated by a single tab character. | |
b5dc1377 CL |
83 | .Tp Cx Fl d |
84 | .Cx \&\ \& | |
85 | .Ar char | |
86 | .Cx | |
12cf7852 | 87 | Use |
b5dc1377 | 88 | .Ar char |
12cf7852 | 89 | as the field delimiter character instead of the tab character. |
b5dc1377 | 90 | .Tp Fl s |
12cf7852 KB |
91 | Suppresses lines with no field delimiter characters. |
92 | Unless specified, lines with no delimiters are passed through unmodified. | |
b5dc1377 CL |
93 | .Tp |
94 | .Pp | |
95 | .Nm Cut | |
5325ced3 | 96 | exits 0 on success, 1 if an error occurred. |
b5dc1377 CL |
97 | .Sh SEE ALSO |
98 | .Xr paste 1 | |
99 | .Sh STANDARDS | |
12cf7852 | 100 | The |
b5dc1377 | 101 | .Nm cut |
12cf7852 | 102 | function is expected to be POSIX 1003.2 compatible. |