Manual / cut
cut(1)
| CUT(1) | General Commands Manual | 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 delim ] [ -s ] [
file ] ...
DESCRIPTION
Cut selects portions of each line of each named file (standard input default) and writes them to the standard output. Exactly one of -b, -c, -f must be given.
List is a comma-separated list of numbers and number ranges, one-based: N selects one position, N-M a range, N- everything from N to the end of the line, and -M everything from the start of the line through M. The positions or fields named need not be in order, and may overlap; each is still selected only once, and the output carries them in the order they appear in the line, not the order they appear in list.
-b and -c select list as byte or character positions. This machine has no multibyte characters, so the two are the same operation, and -n (which asks that a multibyte character not be split) is accepted with -b but has nothing to do.
-f selects list as delimiter-separated fields, the default delimiter being <tab>. -d delim names a different delimiter, exactly one character. The delimiter separating two selected fields in the output is the same byte as the input delimiter.
A line containing no delimiter byte is written unchanged, list notwithstanding, unless -s is given, in which case it is suppressed entirely.
FILES
/usr/man/CUT this page
SEE ALSO
DIAGNOSTICS
Exit status is 0; 1 if a file named on the command line could not be opened -- that file is skipped, a diagnostic naming it is written to standard error, and the remaining operands are still processed; 2 for a usage error, including a missing or duplicated mode flag, a malformed list, or a -d argument that is not exactly one character.
BUGS
A line longer than 255 bytes is truncated at that length before list is applied.
| September 14, 2026 | maux |