- csplit
-
The csplit command in Unix is a utility that is used to split a file into two or more smaller files determined by context lines.
Contents
Usage
The command-syntax is:
csplit (optional parameters) (input filename) (patterns)
The patterns may be line numbers or regular expressions. The program outputs pieces of the file separated by the patterns into files xx00, xx01, etc., and outputs the size of each piece, in bytes, to standard output.
The optional parameters modify the behaviour of the program in various ways. For example, the default prefix string (xx) and number of digits (2) in the output filenames can be changed.
As with most Unix utilities, a return code of 0 indicates success, while nonzero values indicate failure.
Comparison to split
The split command also splits a file into pieces, except that all the pieces are of a fixed size (measured in lines or bytes).
See also
- List of Unix programs
- split (Unix)
References
- The Single UNIX® Specification, Issue 7 from The Open Group : split files based on context – Commands & Utilities Reference,
- Linux User Commands Manual : split a file into sections determined by context lines –
- Ellen Siever, Aaron Weber, Stephen Figgins, Robert Love, Arnold Robbins, et al. Linux in a Nutshell, 5th Edition. O'Reilly Media: July 2005. ISBN 978-0-596-00930-4.
Unix command-line interface programs and shell builtins (more) File system Processes User environment Text processing Shell builtins Networking Searching Documentation Miscellaneous List of Unix utilities Categories:- Standard Unix programs
- Unix SUS2008 utilities
Wikimedia Foundation. 2010.