Cut out Selected Fields of Each Line of Text
Usage: cut [-hsr-] [-c<list>] [-f<list>] [-d<delims>]
[ file1 file2 ...]
cut can be used to select certain columns or fields from each
line of input. If the -c option is used, fields are defined
as specific character positions. If the -f option is used,
the fields can be of variable length, each field separated
from the next by the delimiter character. If no files are
specified, cut reads input data from stdin.
A list of fields or character positions is specified as a
comma-separated list of integers. The minus sign can be used
to indicate a range. Here are some examples: 1,4,7; 1-3,8;
-5,10 (short for 1-5,10); or 3- (short for third through last
field.) Ranges can be reversed, e.g., -f5-2 or even -c80-1.
If a character range is reversed, any characters in those
positions will be copied to the output in reverse order.
Options:
-h Help. (This screen.)
-s Suppress lines with no delimiters in case of
-f option. Otherwise, lines with no delimiters
are passed through unchanged.
-c<list> The list specifies character positions.
-f<list> The list specifies field numbers.
-d<delims> The specified characters are used as the field
delimiters with the -f option. Any number of
delimiters can be specified. The default is
the tab character.
-r Repeated delimiters are treated as if only a
single delimiter had appeared.
-- End of options.
|