HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)
c
cut(1) cut(1)
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
specified in the char given to the
-d option. cut recognizes the international code set characters accord-
ing to the locale specified in the
LC_CTYPE environment variable.
EXAMPLES
Password file 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 file source containing lines of arbitrary length into two files where
file1 contains the first
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 fields, including the new-line char-
acter (see limits(5).
bad list for b/c/f option
Missing -b, -c,or -f option or incorrectly specified list. No error occurs if a line has
fewer fields 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
HP-UX 11i Version 1: September 2005 − 2 − Hewlett-Packard Company Section 1−−163