shellspells beta

csplit

csplit [OPTION]... FILE PATTERN...

csplit is used to split a file into two or more smaller files based on context.

A little known utility which can occasionally be very useful. To be honest much of what it does can be accomplished in other ways, but it can be handy nontheless.

Examples

Split a file into 10 smaller files, each containing 100000 lines:

csplit -f prefix bigfile.txt 100000 {10}

Split a file into 10 smaller files, whenever a line starts with '000000,'

csplit -f prefix bigfile.txt /^000000,/ {10}