| csplit | |
|---|---|
| Operating system | Unix andUnix-like |
| Platform | Cross-platform |
| Type | Command |
| License | GNU GPL v3 |
csplit is ashellcommand for splitting afile into two or more smaller files determined by context lines. The command is commonly available onUnix andUnix-likeoperating systems.
The command is part of theX/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX and theSingle Unix Specification.[1] It first appeared in PWB UNIX.[2] The version inGNUcoreutils was written by Stuart Kemp and David MacKenzie.[3] The command is available forWindows viaUnxUtils.[4]
Thecommand line arguments consist of options, a file path and a list of patterns.
Each patterns is aline number orregular expression. The program outputs pieces of the file separated by the patterns into filesxx00,xx01, etc., and outputs the size of each piece, inbytes, tostandard output.
Thesplit command also splits a file into pieces, although the pieces are of a fixed size, measured in lines or bytes.
csplit – Shell and Utilities Reference,The Single UNIX Specification, Version 5 fromThe Open Groupcsplit(1) – FreeBSD General CommandsManualcsplit: split files based on context – Shell and Utilities Reference,The Single UNIX Specification, Version 5 fromThe Open Group