Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins
*** 1,228 ****
CUT(1) User Commands 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
Use the cut utility to cut out columns from a table or fields from each
! line of a file; in data base parlance, it implements the projection of
! a relation. The fields as specified by list can be fixed length, that
! is, character positions as on a punched card (-c option) or the length
! can vary from line to line and be marked with a field delimiter
! character like TAB (-f option). cut can be used as a filter.
-
Either the -b, -c, or -f option must be specified.
!
! Use grep(1) to make horizontal ``cuts'' (by context) through a file, or
paste(1) to put files together column-wise (that is, horizontally). To
! reorder columns in a table, use cut and paste.
OPTIONS
The following options are supported:
! list
! A comma-separated or blank-character-separated list of
! integer field numbers (in increasing order), with optional
! - to indicate ranges (for instance, 1,4,7; 1-3,8; -5,10
! (short for 1-5,10); or 3- (short for third through last
! field)).
!
!
! -b list
The list following -b specifies byte positions (for
! instance, -b1-72 would pass the first 72 bytes of each
line). When -b and -n are used together, list is adjusted
so that no multi-byte character is split.
!
! -c list
The list following -c specifies character positions (for
! instance, -c1-72 would pass the first 72 characters of
each line).
!
! -d delim
The character following -d is the field delimiter (-f
! option only). Default is tab. Space or other characters
! with special meaning to the shell must be quoted. delim
! can be a multi-byte character.
!
! -f list
The list following -f is a list of fields assumed to be
! separated in the file by a delimiter character (see -d );
! for instance, -f1,7 copies the first and seventh field
only. Lines with no field delimiters will be passed
! through intact (useful for table subheadings), unless -s
! is specified.
! -n
! Do not split characters. When -b list and -n are used
! together, list is adjusted so that no multi-byte character
! is split.
! -s
! Suppresses lines with no delimiter characters in case of
! -f option. Unless specified, lines with no delimiters
! will be passed through untouched.
OPERANDS
The following operands are supported:
! file
! A path name of an input file. If no file operands are
! specified, or if a file operand is -, the standard input will
! be used.
! USAGE
! See largefile(5) for the description of the behavior of cut when
! encountering files greater than or equal to 2 Gbyte (2^31 bytes).
EXAMPLES
Example 1 Mapping user IDs
-
A mapping of user IDs to names follows:
- example% cut -d: -f1,5 /etc/passwd
-
-
-
Example 2 Setting current login name
-
To set name to current login name:
- example$ name=`who am i | cut -f1 -d' '`
-
-
-
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables
that affect the execution of cut: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
! and NLSPATH.
! EXIT STATUS
! The following exit values are returned:
- 0
- All input files were output successfully.
-
-
- >0
- An error occurred.
-
-
- ATTRIBUTES
- See attributes(5) for descriptions of the following attributes:
-
-
-
-
- +--------------------+-----------------+
- | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
- +--------------------+-----------------+
- |CSI | Enabled |
- +--------------------+-----------------+
- |Interface Stability | Standard |
- +--------------------+-----------------+
-
SEE ALSO
! grep(1), paste(1), attributes(5), environ(5), largefile(5),
! standards(5)
! DIAGNOSTICS
! cut: -n may only be used with -b
!
!
!
!
! cut: -d may only be used with -f
!
!
!
!
! cut: -s may only be used with -f
!
!
!
!
! cut: cannot open <file>
!
! Either file cannot be read or does not exist. If multiple files
! are present, processing continues.
!
!
! cut: no delimiter specified
!
! Missing delim on -d option.
!
!
! cut: invalid delimiter
!
!
!
!
! cut: no list specified
!
! Missing list on -b, -c, or -f option.
!
!
! cut: invalid range specifier
!
!
!
!
! cut: too many ranges specified
!
!
!
!
! cut: range must be increasing
!
!
!
!
! cut: invalid character in range
!
!
!
!
! cut: internal error processing input
!
!
!
!
! cut: invalid multibyte character
!
!
!
!
! cut: unable to allocate enough memory
!
!
!
!
!
!
! April 29, 1999 CUT(1)
--- 1,123 ----
CUT(1) User Commands CUT(1)
NAME
! cut - cut out selected columns or fields of each line of a file
SYNOPSIS
! cut -b list [-nN] [-r reclen] [file]...
+ cut -c list [-N] [-r reclen] [file]...
! cut -f list [-s] [-d delim] [-D ldelim] [file]...
DESCRIPTION
Use the cut utility to cut out columns from a table or fields from each
! line of a file. In database parlance, it implements the projection of a
! relation. The fields as specified by list can be fixed length, that is,
! character positions as on a punched card (-c option) or the length can
! vary from line to line and be marked with a field delimiter character
! such as TAB (-f option). cut can be used as a filter.
Either the -b, -c, or -f option must be specified.
! Use grep(1) to make horizontal cuts (by context) through a file, or
paste(1) to put files together column-wise (that is, horizontally). To
! reorder columns in a table, use cut and paste(1).
OPTIONS
The following options are supported:
! -b list, --bytes=list
The list following -b specifies byte positions (for
! instance, -b 1-72 would pass the first 72 bytes of each
line). When -b and -n are used together, list is adjusted
so that no multi-byte character is split.
! -c list, --characters=list
The list following -c specifies character positions (for
! instance, -c 1-72 would pass the first 72 characters of
each line).
! -d delim, --delimiter=delim
The character following -d is the field delimiter (-f
! option only); the default is the TAB character. Space or
! other characters with special meaning to the shell must be
! quoted. delim can be a multi-byte character.
! -f list, --fields=list
The list following -f is a list of fields assumed to be
! separated in the file by a delimiter character (see -d);
! for instance, -f 1,7 copies the first and seventh field
only. Lines with no field delimiters will be passed
! through intact (useful for table subheadings), unless -s is
! specified.
+ -n, --split, --nosplit
+ Controls whether multi-byte characters are split with the
+ -b option. The default is to split characters and this can
+ be disabled with the -n or --nosplit flag. Unless
+ specified, lines with no delimiters will be passed through
+ untouched.
! -r reclen, -R reclen, --reclen=reclen
! If reclen is > 0, the input will be read as fixed length
! records of length reclen when used with the -b or -c
! options.
+ -s, --suppress, --only-delimited
+ Suppress lines which do not contain any delimiter
+ characters (-f option only).
! -D ldelim, --line-delimiter=ldelim, --output-delimiter=ldelim
! The line delimiter for the -f option is set to ldelim. The
! default is the newline character.
+ -N, --newline, --nonewline
+ Controls whether to output a new-line at the end of each
+ record when used with the -b or -c options. This is on by
+ default; -N turns it off and is the same as specifying
+ --nonewline.
+ In the above options, list is a comma-separated or blank-character-
+ separated list of integer field, byte or character numbers (in increasing
+ order), with optional - to indicate ranges (for instance, 1,4,7; 1-3,8;
+ -5,10 (short for 1-5,10); or 3- (short for third through last field). )
+
OPERANDS
The following operands are supported:
! file A path name of an input file. If no file operands are
! specified, or if a file operand is -, the standard input
! will be used.
+ EXIT STATUS
+ 0 All input files were output successfully.
! >0 An error occurred.
EXAMPLES
Example 1 Mapping user IDs
A mapping of user IDs to names follows:
+ $ cut -d: -f1,5 /etc/passwd
Example 2 Setting current login name
To set name to current login name:
+ $ name=`who am i | cut -f1 -d' '`
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables
that affect the execution of cut: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
! LC_NUMERIC, and NLSPATH.
! INTERFACE STABILITY
! The command line interface of cut is Committed. The output of cut is
! Committed.
SEE ALSO
! grep(1), paste(1), attributes(5), environ(5), largefile(5), standards(5)
! illumos February 9, 2021 illumos