Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (c) csplit(1)
NAME
csplit - Splits files by context
SYNOPSIS
csplit [-f prefix][-ks][-n number][file | -] argument ...
The csplit command reads the specified file and separates it into segments defined by the
specified arguments.
FLAGS
-f prefix Specifies the prefix name (xx by default) for the created file segments. If the
prefix argument would create a filename larger than NAME_MAX bytes, an
error results, the csplit command exits with a diagnostic message, and no files
are created.
-k Keeps created file segments intact in the event of an error.
-n number
Uses number decimal digits to form filenames for the file segments. The
default value is 2.
-s Suppresses the display of character counts.
DESCRIPTION
If you specify - (dash) in place of the input filename, the csplit command reads from the standard
input file.
By default, csplit writes the file segments to files named xx00 ...xxn, where n is the number of
arguments listed on the command line. By default, these new files get the following segments of
file:
00 From the start of file up to, but not including, the line referenced by the first
argument.
01 From the line referenced by the first argument up to the line referenced by the
second argument.
n+1 From the line referenced by the last argument to the end of file.
The csplit command does not alter the original file.
The specified arguments can be a combination of the following:
/pattern/[offset]
Creates a file 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 file is created.
+number
-number Move forward or backward the specified number of lines from the line matched
by an immediately preceding pattern argument.
line_number
Creates a file containing the segment from the current line up to, but not
including, line_number, which becomes the current line.
527188-004 Hewlett-Packard Company 2−77