Name

csplit

Synopsis

    csplit [options]file arguments

Separate file into sections and place sections in files named xx00 through xx n (n < 100), breaking file at each pattern specified in arguments. A filename of - reads from standard input. See also split.

Common Options

-fprefix, --prefix=prefix

Name new files prefix 00 through prefixN (default is xx00 through xx n).

-k, --keep-files

Keep newly created files, even when an error occurs (which would normally remove these files). This is useful when you need to specify an arbitrarily large repeat argument, { n }, and you don’t want the “out of range” error to remove the new files.

-nnum, --digits=num

Use output filenames with numbers num digits long. The default is 2.

-s, --quiet, --silent

Suppress all character counts.

GNU/Lnux Options

-bsuffix, --suffix-format=suffix

Append suffix to output filename. This option causes -n to be ignored. suffix must specify how to convert the binary integer to readable form by including one of the following: %d, %i, %u, %o, %x, or %X. The value of suffix determines the format for numbers as follows:

%d, %i

Signed decimal.

%u

Unsigned decimal.

%o

Octal.

%x, %X

Hexadecimal.

-q

Same as -s.

-z, --elide-empty-files

Do not create empty output files. However, number as if those files had been created.

Arguments

Any one or a combination of the following expressions. Arguments containing blanks or other special characters should be surrounded by single quotes.

/ expr /

Create file from the current line up to the ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.