|
|
1.1 root 1: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
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.
17: .\"
18: .\" @(#)cut.1 5.3 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
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
37: The
38: .Nm cut
39: utility selects portions of each line (as specified by
40: .Ar list )
41: from each
42: .Ar file
43: (or the standard input by default), and writes them to the
44: standard output.
45: The items specified by
46: .Ar list
47: can be in terms of column position or in terms of fields delimited
48: by a special character. Column numbering starts from 1.
49: .Pp
50: .Ar List
51: is a comma or whitespace separated set of increasing numbers and/or
52: number ranges.
53: Number ranges consist of a number, a dash
54: .Li (``\-'') ,
55: and a second number
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.
65: .Pp
66: The options are as follows:
67: .Tw Fl
68: .Tp Cx Fl c
69: .Cx \&\ \&
70: .Ar list
71: .Cx
72: The
73: .Ar list
74: specifies character positions.
75: .Tp Cx Fl f
76: .Cx \&\ \&
77: .Ar list
78: .Cx
79: The
80: .Ar list
81: specifies fields, delimited in the input by a single tab character.
82: Output fields are separated by a single tab character.
83: .Tp Cx Fl d
84: .Cx \&\ \&
85: .Ar char
86: .Cx
87: Use
88: .Ar char
89: as the field delimiter character instead of the tab character.
90: .Tp Fl s
91: Suppresses lines with no field delimiter characters.
92: Unless specified, lines with no delimiters are passed through unmodified.
93: .Tp
94: .Pp
95: .Nm Cut
96: exits 0 on success, 1 if an error occurred.
97: .Sh SEE ALSO
98: .Xr paste 1
99: .Sh STANDARDS
100: The
101: .Nm cut
102: function is expected to be POSIX 1003.2 compatible.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.