CSPLIT(1)
π CSPLIT(1) π
okay bestie, welcome to the csplit page β that's short for context split, and it lives in the General Commands Manual, section 1, right where all the tiny command-line icons hang out. β¨
πΈ NAME πΈ
csplit β split a file into sections determined by context lines π¦
π SYNOPSIS π
csplit [OPTION]... FILE PATTERN...
π DESCRIPTION π
Split a file into sections determined by context lines. that's it, that's the whole personality. no cap. π«Ά
β¨ OPTIONS β¨
every single one, no skipping, we do not gatekeep here π
-b,--suffix-format<FORMAT> β use sprintfFORMATinstead of%02dπ-f,--prefix<PREFIX> β usePREFIXinstead of'xx'π-k,--keep-filesβ do not remove output files on errors. your files stay put, bestie π--suppress-matchedβ suppress the lines matchingPATTERNπ₯-n,--digits<DIGITS> β use specified number of digits instead of2π’-q,--quietβ do not print counts of output file sizes π€«-z,--elide-empty-filesβ remove empty output files π-h,--helpβ Print help π«Ά-V,--versionβ Print version π
π EXTRA π
Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output. so it splits the file AND tells you how big each lil piece is. main character energy fr fr π
π VERSION π
v(uutils coreutils) 0.12.0 β yep, uutils coreutils, the iconic Rust remix, and this is version 0.12.0 β
π EXAMPLES π
Split a file in two parts, starting the second one at line 10:
csplit path/to/file 10
Split a file in three parts, starting the latter parts in lines 7 and 23:
csplit path/to/file 7 23
Start a new part at every 5th line (will fail if number of lines is not divisible by 5):
csplit path/to/file 5 {*}
Start a new part at every 5th line, ignoring exact-division error:
csplit [-k|--keep-files] path/to/file 5 {*}
Split a file above line 5 and use a custom prefix for the output files (default is xx):
csplit path/to/file 5 [-f|--prefix] prefix
Split a file above the first line matching a regex pattern:
csplit path/to/file /regex/
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. π not everything's finished yet, it's giving "beta era" but we love it anyway π«Ά
and that's a wrap, bestie π this whole thing dropped as part of the General Commands Manual on 2026-09-25 (CSPLIT(1), if you're being formal about it) β go split some files, you're gonna slay β¨ππ
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms