csplit
| csplit | |
|---|---|
| Repository |
|
| Engine | |
| Operating system | Unix and Unix-like |
| Platform | Cross-platform |
| Type | Command |
| License | GNU GPL v3 |
csplit is a shell command for splitting a file into two or more smaller files determined by context lines. The command is commonly available on Unix and Unix-like operating systems.
The command is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX and the Single Unix Specification.[1] It first appeared in PWB UNIX.[2] The version in GNU coreutils was written by Stuart Kemp and David MacKenzie.[3] The command is available for Windows via UnxUtils.[4]
Usage
[edit | edit source]The command line arguments consist of options, a file path and a list of patterns.
Each patterns is a line number or regular expression. 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.
Comparison to split
[edit | edit source]The split command also splits a file into pieces – except that the pieces are of a fixed size; measured in lines or bytes.
See also
[edit | edit source]References
[edit | edit source]- ^ – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group
- ^ – FreeBSD General Commands Manual
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
Further reading
[edit | edit source]- Ellen Siever, Aaron Weber, Stephen Figgins, Robert Love, Arnold Robbins, et al. Linux in a Nutshell, 5th Edition. O'Reilly Media: July 2005. Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)..
External links
[edit | edit source]- : split files based on context – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group