cut

QNX SDP8.0Utilities ReferenceUtilities

Print selected fields of each line of a file to standard output (POSIX, toybox)

Syntax:

cut [-Ds] [-bcCfF list] [-d delim] [-O separator] [file...]

Runs on:

QNX OS

Options:

-b list
Cut based on bytes specified by list. Each selected byte is output unless -n is also specified.
-C list
Select Unicode columns.
-c list
Select UTF-8 characters.
-D
Don't sort and collate selections or match lines specified by -f or -F without a delimiter. By default, selections are sorted and collated.
-d delim
Use delim as the delimiter character (default is a tab character for -f, run of empty-space for -F.)
-F list
Select fields separated by a delim regular expression.
-f list
Select fields (words) separated by a single delim character.
-n
Do not split characters. When specified with -b, cut uses the following methods to handle low-high ranges specified by list:
  • If the specified low byte is not the first byte of a character, it is rounded down to the first byte of the UTF-8 character. If the range does not specify a high value (i.e., number-), the high value is the number of bytes in the current line, not including the terminating newline.
  • If the specified high byte is not the last byte of a character, it is rounded to the last byte of the character prior to the character, or zero if there is no prior character. If the range does not specify a low value (i.e., -number), the low value is 1.
If list specifies single numbers, each number is handled as both the high and low number.
-O separator
Output separator (default is one space for -F, or the input delimiter character for -f.)
-s
Skip lines that don't have delimiters.
file
The pathname of a text file, whose contents are used instead of the standard input.

Description:

For every file you name, the cut utility cuts out columns or fields from each line, concatenates them, and writes them to standard output.

Each selection specified by list is comma separated, either by numbers (counting from one) or by dash-separated, low-high ranges (number-number).

The range number- specifies from number to the end of the line, and -number specifies from the start of the line to number. If you specify -n,

This utility is provided as part of the toybox package. For information on how to enable it, see toybox.

Contributing author:

Rob Landley and the toybox project (see https://landley.net/toybox/).

Page updated: