Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

csplit(1) OSS Shell and Utilities Reference Manual
{number}
Repeats the preceding argument the specied number of times. This number
can follow any of the pattern or line_number arguments. If it follows a pattern
argument, the csplit command reuses that pattern the specied number of
times. If it follows a line_number argument, csplit splits the le from that
point every line_number of lines for number times.
Place within quotation marks all pattern arguments that contain spaces or other charac-
ters special to the shell. Patterns may not contain embedded newline characters.
See the reference page for the grep command for information about creating patterns. In
an expression such as [a-z], the dash means "through" according to the current collating
sequence. The collating sequence is determined by the value of the LC_COLLATE
environment variable.
EXAMPLES
a. To split the text of a book into a separate le for each chapter, enter:
csplit book "/ˆChapter *[0-9]/" {9}
This command creates les named xx00, xx01, xx02,...,xx09, and xx10, which
contain individual chapters of the le book. The le xx00 contains the front
matter that comes before the rst chapter. The {9} after the pattern causes the
csplit command to create individual chapters up until le xx09; the remainder of
book is then placed in le xx10.
b. To specify the prex for the created lenames, enter:
csplit -f chap book "/ˆChapter *[0-9]/" {9}
This command splits book into les named chap00, chap01,...chap9, and
chap10.
RELATED INFORMATION
Commands: ed(1), sh(1), split(1).
Files: locale(4).
278 Hewlett-Packard Company 527188-004