HP-UX Reference (11i v2 07/12) - 1 User Commands A-M (vol 1)

c
cut(1) cut(1)
International Code Set Support
cut supports both single- and multibyte 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.
DIAGNOSTICS
line too long
Line length must not exceed LINE_MAX characters or fields, including the newline character
(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.
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 multibyte character), and
file2 contains the remainder of
each line:
cut -b 1-500 -n source > file1
cut -b 500- -n source > file2
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 2: December 2007 Update 2 Hewlett-Packard Company 223