Name
csplit
Synopsis
csplit [options
]file arguments
Separate file into context-based sections and place sections in files named xx00 through xxn (n < 100), breaking file at each pattern specified in arguments. The byte count for each section is written to standard output. See also split.
Options
- -
Read from standard input.
- -b format, --suffix-format=format
Use sprintf format instead of %02d for the suffix.
- -f prefix, --prefix=prefix
Name new files prefix00 through prefixn (default is xx00 through xxn).
- -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 an out-of-range error to cause removal of the new files.
- -n num, --digits=num
Use output filenames with numbers num digits long. The default is 2.
- -s, -q, --silent, --quiet
Suppress display of character counts.
- -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 may be specified as arguments. Arguments containing blanks or other special characters should be surrounded by single quotes.
- /expr/[offset]
Create file from the current line up to the line containing the regular expression expr. offset should be of the form +n or -n, where n is the number of lines below or above expr.
- %expr%[offset]
Same as /expr/, except no file is created for lines before a line containing expr.
Get Linux in a Nutshell, 6th 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.