Version 0.2.1 behavior is documented here. Thesupport record separates local verification frompublished MoonX behavior; moonx examples use registry releases.
Split a file into sections at line numbers or basic regular expressions:
NUMBER splits before that absolute line; /REGEXP/ splits before a matchingline and %REGEXP% discards the preceding section. Regex delimiters may befollowed by a positive or negative line offset. {N} repeats the precedingpattern N additional times. Regex {*} repeats through the remaining input;numeric repetitions that reach beyond the last line report an error.The first operand - reads stdin. All input bytes, including NUL and anunterminated final line, are preserved in selected fragments.
Files are named xx00, xx01, … . -f/--prefix changes the prefix and-n/--digits sets the minimum number of suffix digits. Byte counts are printedfor created files unless -s/--silent or -q/--quiet is selected.-z/--elide-empty-files omits empty fragments. Split failures remove the filescreated by that invocation unless -k/--keep-files is used.
-b/--suffix-format replaces the default digits with exactly one d/i/u/o/x/Xinteger conversion, literal text and %%. Width, precision, left/zero paddingand applicable alternate/thousands flags follow the GNU C profile. Repeatedformats use the last; -b determines layout independently of -n ordering.Invalid formats fail before file creation.Windows ordinary filesystem paths trim trailing spaces and dots. A generatedname with either ending is therefore refused with status 2 before readinginput; it never silently creates a differently named fragment. Verbatim-namesupport requires verified Native/Wasm creation, reading and observation ofthose exact names.
--suppress-matched omits the line at the offset-adjusted split boundary forregex, ignored regex and numeric patterns. Empty elision reuses the nextoutput suffix; suppression preserves the separate regex-search cursor.
Input is consumed once into an owned temporary snapshot before creating fragments.The snapshot and its 64-bit line-offset index stay on disk; each index/data cacheis at most 64 KiB. Numeric splits copy byte ranges in 64 KiB blocks. Regex searchesretain only the current line, so their extra memory includes the largest matchedor searched line, rather than every input record. Temporary disk use is the inputbyte count plus eight bytes per line boundary, including the initial boundary.Created output paths remain in memory for failure cleanup. Regex line storage andnumeric pattern/offset parsing keep their existing signed 32-bit limits; file andindex positions use checked signed 64-bit arithmetic.
The temporary directory and its files are exclusive to the invocation; snapshotfiles use mode 0600. They are removed after success, ordinary errors and cancellationobserved by the runtime. A killed process or machine failure cannot guarantee thatcleanup. Temp creation/write or input-read errors occur before fragment creation.After splitting begins, -k keeps completed or partial fragments; without it,the invocation removes only the fragment paths it created.
The shared C-byte BRE matcher compiles each expression onceand supports capture backreferences, byte classes and word assertions.Repeated nullable captures follow the tested GNU candidate and capture-registerselection, including counted repeats and references. See theworkspace support record.Existing output paths are refused. Locale-sensitive matching is outside theselected profile. --help and --version provide commandinformation.
Standalone --version prints exactly csplit 0.2.1 followed by onenewline. Standalone --help starts with Usage: csplit, lists bothmetadata options, and ends with a newline. Both write to stdout, leave stdinunread, and exit with status 0. Exact-version publication and verificationremain recorded separately in the support record.