CUT(1)

NAME
cut - cut out selected fields of each line of a file

SYNOPSIS
cut -b list [-n] [file . . . ]
cut -c list [file . . . ]
cut -f list [-d char] [-s] [file . . . ]

DESCRIPTION
The cut utility selects columns of files for printing based either on byte position, character position, or field delimiters.

If no file is given, or if file is -, cut reads from standard input.

The list consists of numbers separated by commas or blanks that select the corresponding input field, starting at 1. Ranges of fields may be given as in

m-n Selects all fields from m to n.

m-  Selects all fields from m to the last field of each input line.

-n  Selects all fields from the first field to n.

The cut command accepts the following options:

-c list
    Each character of an input line forms a column. All selected characters are printed without intervening separators; all newline characters of the input file are passed through.

-d char
    Sets the field delimiter character for the -f option to char.

-f list
    Columns are sequences of zero or more characters separated by a field delimiter character, by default a tabulator (\t). The selected fields are printed, separated by the field delimiter character. Lines that do not contain the field delimiter character are passed through unchanged.

-s  With the -f option, lines that do not contain the field delimiter character are not passed through.

The following options were introduced by POSIX.2:

-b list
    Each single byte of an input line forms a column. All selected bytes are printed without intervening separators; all newline characters of the input file are passed through.

-n  Changes the behavior of the -b option such that ranges start and end at character boundaries.

ENVIRONMENT VARIABLES

LANG, LC_ALL
    See locale(7).

LC_CTYPE
    Determines the mapping of bytes to characters for the argument to the -d option and in input files processed with the -bn, -c, and -f options.

SEE ALSO
paste(1), locale(7)

NOTES
Since cut -f cannot be told to recognize both space and tabulator as delimiters, or to take adjacent delimiter characters as single delimiters, it is not generally usable to select fields of white-space separated tables. Use awk(1) for this purpose.