Skip to content

Instantly share code, notes, and snippets.

@dtjohnso
Created May 7, 2020 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtjohnso/cfbdbffd53cebac3d569eae94815616c to your computer and use it in GitHub Desktop.
Save dtjohnso/cfbdbffd53cebac3d569eae94815616c to your computer and use it in GitHub Desktop.
Split a Markdown file into separate files at the ## h2 heading
# A script to split a .MD file into chunks, separating on h2 ## headings
# Duncan Johnson
# csplit test.md -f 'ch' --suffix-format='%03d.md' "/^## /" "{*}" -s
csplit $1 -f 'ch' --suffix-format='%02d.md' "/^## /" "{*}" -s
@seanvosler
Copy link

im a dummy, been trying to do this in terminal on mac osx - no luck, thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment