This documentation reflects EDirect version 7.60, released on 11/14/2017.
We strive to keep this documentation up-to-date with the latest release. If you are looking for documentation on a more recent version of EDirect, or to find out more about new EDirect releases, please see the Release Notes of NCBI's EDirect documentation.
cut command trims off a portion of each line of text input to the command. To see a full list of arguments, options, and features of
cut, see the
cut documentation page, or type
into your terminal to see the manual page for
One or more lines of text.
Specific portions of each of the input lines of text, as specified by the arguments.
To use the
cut command, you must specify which portion of your input you wish to retain. Only the portions of your input you specify will be output. In order to specify the portion of your input you wish to keep, you need to use either the
-c or the
-c argument allows you to specify a range of characters which you would like to retain.
-f argument allows you to specify a range of fields you would like to retain. By default, the tab character is the default delimiter of
cut, but you can set a different delimiter using the
With either the
-c or the
-f argument, you specify the range using one of four options:
N: Retains only the N-th character or field (counted from 1).
N-: Retains all characters or fields from the N-th to the end of the line.
N-M: Retains all characters or fields from the N-th to the M-th.
-M: Retains all characters or fields from the first to the M-th.
Retain only the 3rd field (fields in the input are delimited by tabs):
cut -f 3
Retain only the first four characters:
cut -c -4
Retain all but the first character:
cut -c 2-
Retain only the 2nd, 3rd and 4th fields (fields in the input are delimited by “|”):
cut -f 2-4 -d "|"