Skip to Content
gnux

-b, --suffix-format

Use sprintf FORMAT instead of %02d.

An option of csplitx.

Usage

csplitx -b FORMAT FILE PATTERN...
csplitx --suffix-format=FORMAT FILE PATTERN...

Details

ShortLongValueDefaultMeaning
-b--suffix-formatFORMATuse sprintf FORMAT instead of %02d

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 '/^---$/' '{*}'

Help in the terminal

gnux help csplitx --suffix-format

On this page