csplit

Split file into smaller files by context

Usage: csplit options filename [prefix]

Smaller files will be prefix00, prefix01, prefix02

Default prefix is xx

Standard Input: Not used

Standard Output: Not used

SEE ALSO

For more information, see page 288

Useful options:

-k preserves created files in spite of errors such as using 99 as a repeat count.

Examples:

csplit -k filename '/Chapter/' '{99}'
csplit filename '/boundaryword/' '/boundaryword/'
/boundaryword/'

Get Practical UNIX 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.