Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have what I think is a really simple problem to solve (preferably with OS X / *nix terminal tools rather than windows command line).

I have a manuscript formatted in markdown with # (H1) denoting a chapter heading. I would like to break this large file up into smaller chapter files as I'll later be converting the manuscript to epub / mobi with pandoc. This separate-file-per-chapter format is the the recommended format according to the pandoc docs (http://johnmacfarlane.net/pandoc/epub.html ) and also makes the editing process a little less unwieldy. Interestingly it is similar to what some other projects have done e.g. https://github.com/visionmedia/masteringnode

I was thinking that this would be possible with a simple python script or using something like sed but I just don't know where to start. Any help would be great!

share|improve this question

You're looking for the csplit tool.

share|improve this answer
    
What is it? What does it do? Where can we find it? – Tom Wijsman Jun 5 '12 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .