cut(1)

cut(1)

default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, cut behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

cut supports both single- and multi-byte character code sets. International code set characters may be speci®ed in the char given to the -doption. cut recognizes the international code set characters according to the locale speci®ed in the LC_CTYPE environment variable.

EXAMPLES

Password ®le mapping of user ID to user names:

cut -d : -f 1,5 /etc/passwd

Set environment variable name to current login name:

name=`who am i cut -f 1 -d " "`

Convert ®le source containing lines of arbitrary length into two ®les where file1 contains the ®rst 500 bytes (unless the 500th byte is within a multi-byte character), and file2 contains the remainder of each line:

cut -b 1-500 -n source > file1 cut -b 500- -n source > file2

DIAGNOSTICS

line too long

Line length must not exceed LINE_MAX characters or ®elds, including the new-line character (see limits(5).

bad list for b/c/f option

Missing -b, -c, or -foption or incorrectly speci®ed list. No error occurs if a line has fewer ®elds than the list calls for.

no fields list is empty.

WARNINGS

cut does not expand tabs. Pipe text through expand(1) if tab expansion is required.

Backspace characters are treated the same as any other character. To eliminate backspace characters before processing by cut, use the fold or col command (see fold(1) and col(1)).

AUTHOR

cut was developed by OSF and HP.

SEE ALSO grep(1), paste(1).

STANDARDS CONFORMANCE

cut: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

c

HP-UX Release 11i: December 2000

− 2 −

Section 1163