Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.