cutselectively display fields or characters from input lines |
Command |
cut
-b
list
[-n
]
[file...]
cut
-c
list[file...]
cut
-f
list
[-d
char]
[-s
]
[file...]
cut
reads input from files and selectively copies
sections of the input lines to the standard output. If you do not specify any
files, or you specify a file named -
, cut
reads from the standard input.
-b
listinvokes byte position mode. After this comes a list of the byte
positions you want to display. This list may contain multiple byte
positions, separated by commas (,
) or blanks, or ranges of
positions separated by dashes (-
); since the list must be one
argument, shell quoting is necessary if blanks are used. You may combine
these to select any set of byte positions.
-c
listinvokes character position mode. After this comes a list of character
positions to retain in the output. This list may contain multiple
character positions, separated by commas (,
) or blanks or
ranges of positions separated by a single dash (-
); since the
list must be one argument, shell quoting is necessary if blanks are used.
You may combine these to select any set of character positions.
-d
charspecifies char as the character that separates fields in the input data; by default, this is the horizontal tab.
-f
listinvokes field delimiter mode. After this comes a list of the fields you
want to display. This list may contain multiple fields, separated by
commas (,
) or blanks or ranges of fields separated by a
single dash (-
); since the list must be one argument, shell
quoting is necessary if blanks are used. You may combine these to select
any set of fields.
-n
does not split characters. If the low byte in a selected range is not
the first byte of a character, cut
extends the range
downward to include the entire character; if the high byte in a selected
range is not the last byte of a character, cut
limits
the range to include only the last entire character before the high byte
selected. If -n
is selected, cut
does not list ranges that do not encompass an entire character and these
ranges do not cause an error.
-s
does not display lines that do not contain a field separator character.
Normally, cut
displays lines that do not contain a
field separator character in their entirety.
ls
-l
command and displays only the permissions (that is,
character positions 1-11) as well as the date, time, and file name information
(that is, everything from the 56th character onward) for each file:
ls -l | cut -c 1-11,56-
0
Successful completion.
1
Failure due to any of the following:
2
Failure due to any of the following:
-b
,
-c
or -f