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 sprintf FORMAT instead of %02d πŸ’–
  • -f, --prefix <PREFIX> β€” use PREFIX instead of 'xx' πŸŽ€
  • -k, --keep-files β€” do not remove output files on errors. your files stay put, bestie πŸ™ˆ
  • --suppress-matched β€” suppress the lines matching PATTERN πŸ”₯
  • -n, --digits <DIGITS> β€” use specified number of digits instead of 2 πŸ”’
  • -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