Skip to Content
gnux

-f, --prefix

Use PREFIX instead of 'xx'.

An option of csplitx.

Usage

csplitx -f PREFIX FILE PATTERN...
csplitx --prefix=PREFIX FILE PATTERN...

Details

ShortLongValueDefaultMeaning
-f--prefixPREFIXuse PREFIX instead of 'xx'

Examples

Split a Markdown book into one file per chapter (each starting with '# ')

csplitx -f chapter- -b '%02d.md' book.md '/^# /' '{*}'
Output
0
18234
22917
15002

Do the same without the empty file before the first chapter

csplitx -z -f chapter- -b '%02d.md' book.md '/^# /' '{*}'

Split a multi-document Kubernetes YAML into one manifest per file, dropping the '---' lines

csplitx -z --suppress-matched -f manifest- -b '%02d.yaml' all.yaml '/^---$/' '{*}'

Separate the 3-line header of a report from its body

csplitx -s -f report- report.txt 4
Output
(creates report-00 with lines 1-3 and report-01 with the rest)

Cut a log into one file per day, where each day starts with a '=== 2026-' banner

csplitx -z -f day- app.log '/^=== 2026-/' '{*}'

Split standard input from another command

git log --format='commit %H%n%B' | csplitx -s -z -f commit- - '/^commit /' '{*}'

Help in the terminal

gnux help csplitx --prefix

On this page