CUT(1) General Commands Manual CUT(1)

cutcut each line with selected characters/fields

cut -b list [-n] [file...]

cut -c list [file...]

cut -f list [-d delim] [-s] [file...]

cut reads lines from each each file or if unspecified standard input, and cuts out bytes (-b), characters (-c), or character-delimited fields (-f).

The list argument is a comma-separated list of 1-based ranges, where:

n-
Selects from ‘n’ to the end of line.
n
Selects ‘n
n-m
Selects from ‘n’ to ‘m’.
-m
Selects from start of the line to ‘m’.
1,2,3
is equivalent to ‘1-3

list
Cut bytes based on list.
list
Cut codepoints based on list.
delim
Set the field delimiter to the character delim, if an empty string is passed, then NULL is used as separator. (default: \t)
list
Cut fields based on list.
Do not split codepoints. (Currently unsupported in this implementation)
Suppress lines with no delimiter characters, otherwise whole delimiter-less lines are printed as-is.

The cut utility exits 0 on success, and >0 if an error occurs.

Except for the lack of support for -n, cut should be compliant with the IEEE Std 1003.1-2024 (“POSIX.1”) specification.

Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>

2024-08-24 Linux 6.6.67-gentoo-x86_64