Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (c) cut(1)
NAME
cut - Displays selected parts from each line of a file
SYNOPSIS
cut -b list [-n][file ...]
cut -c list [file ...]
cut -f list [-d character][-s][file ...]
The cut command locates the specified parts in each line of the specified file and writes the
characters in them to the standard output file.
FLAGS
-b list Cuts selections based on a list of bytes. Each selected byte is output, unless
you also specify the -n flag. For example, if you specify -b 1-72, the cut com-
mand writes out the first 72 bytes in each line of the file.
-c list Cuts selections based on a list of characters.
-d character
Uses the specified character as the field delimiter (separator) when you specify
the -f flag. You must quote characters with special meaning to the shell, such
as the space character. Any character can be used as character. The default
field delimiter is a tab character.
-f list Specifies a list of fields assumed to be separated in the file by a field delimiter
character, specified by the -d flag or the tab character by default. For example,
if you specify -f 1,7, the cut command writes out only the first and seventh
fields of each line. If a line contains no field delimiters, cut passes them
through intact (useful for table subheadings) unless you specify the -s flag.
-n Does not split characters. When specified with the -b flag, each element in list
of the form low-high (hyphen-separated numbers) is modified as follows:
• If the byte selected by low is not the first byte of a character, low is
decremented to select the first byte of the character originally selected
by low.
• If the byte selected by high is not the last byte of a character, high is
decremented to select the last byte of the character prior to the charac-
ter originally selected by high, or 0 (zero) if there is no prior character.
If the resulting range element has high equal to 0 (zero) or low greater
than high, the list element is dropped from list for that input line
without causing an error.
Each element in list of the form low- is treated as previously described with
high set to the number of bytes in the current line, not including the terminat-
ing newline character. Each element in list of the form -high is treated as pre-
viously described with low set to 1. Each element in list of the form number (a
single number) is treated as previously described with low set to number and
high set to number.
-s Suppresses lines that do not contain delimiter characters (use only with the -f
flag). Unless you include this flag, lines with no delimiters are passed through.
DESCRIPTION
If you do not specify a file or if you specify a - (dash), the cut command reads the standard input
file.
527188-004 Hewlett-Packard Company 2−79