-
Notifications
You must be signed in to change notification settings - Fork 12
/
cut.1
73 lines (73 loc) · 1.46 KB
/
cut.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.Dd 2015-10-08
.Dt CUT 1
.Os sbase
.Sh NAME
.Nm cut
.Nd extract columns of data
.Sh SYNOPSIS
.Nm
.Fl b Ar list
.Op Fl n
.Op Ar file ...
.Nm
.Fl c Ar list
.Op Ar file ...
.Nm
.Fl f Ar list
.Op Fl d Ar delim
.Op Fl s
.Op Ar file ...
.Sh DESCRIPTION
.Nm
out bytes, characters or delimited fields from each line of
.Ar file
and write to stdout.
.Pp
If no
.Ar file
is given or
.Ar file
is '-',
.Nm
reads from stdin.
.Pp
.Ar list
is a comma or space separated list of numbers and ranges starting
from 1.
Ranges have the form 'N-M'. If N or M is missing, beginning or end
of line is assumed.
Numbers and ranges may be repeated, overlapping and in any order.
.Pp
Selected input is written in the same order it is read
and is written exactly once.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl b Ar list | Fl c Ar list
.Ar list
specifies byte | character positions.
.It Fl d Ar delim
Use
.Ar delim
as field delimiter, which can be an arbitrary string.
Default is '\et'.
.It Fl f Ar list
.Ar list
specifies field numbers.
Lines not containing field delimiters are passed through, unless
.Fl s
is specified.
.It Fl n
Do not split multibyte characters.
A character is written when its last byte is selected.
.It Fl s
Suppress lines not containing field delimiters.
.El
.Sh STANDARDS
The
.Nm
utility is compliant with the
.St -p1003.1-2013
specification.
.Pp
The possibility of separating numbers and ranges with a space and specifying
multibyte delimiters of arbitrary length is an extension to that specification.