Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

User Commands (c) csplit(1)
NAME
csplit - Splits les by context
SYNOPSIS
csplit [-f prex][-ks][-n number][le | -] argument ...
The csplit command reads the specied le and separates it into segments dened by the
specied arguments.
FLAGS
-f prefix Species the prex name (xx by default) for the created le segments. If the
prex argument would create a lename larger than NAME_MAX bytes, an
error results, the csplit command exits with a diagnostic message, and no les
are created.
-k Keeps created le segments intact in the event of an error.
-n number
Uses number decimal digits to form lenames for the le segments. The
default value is 2.
-s Suppresses the display of character counts.
DESCRIPTION
If you specify - (dash) in place of the input lename, the csplit command reads from the standard
input le.
By default, csplit writes the le segments to les named xx00 ...xxn, where n is the number of
arguments listed on the command line. By default, these new les get the following segments of
le:
00 From the start of le up to, but not including, the line referenced by the rst
argument.
01 From the line referenced by the rst argument up to the line referenced by the
second argument.
n+1 From the line referenced by the last argument to the end of le.
The csplit command does not alter the original le.
The specied arguments can be a combination of the following:
/pattern/[offset]
Creates a le using the contents of the lines from the current line up to, but not
including, the line that results from the evaluation of the regular expression
with an offset, if included. The offset argument can be any integer (positive or
negative) that represents a number of lines.
%pattern%[offset]
Has the same effect as /pattern/ except no segment le is created.
+number
-number Move forward or backward the specied number of lines from the line matched
by an immediately preceding pattern argument.
line_number
Creates a le containing the segment from the current line up to, but not
including, line_number, which becomes the current line.
527188-003 Hewlett-Packard Company 277