Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For my research I have a number of text (txt or doc) files. These have a large quantity of newspaper clippings in them.

I'd like to split these text files. Each clipping starts with

document X of Y

I know of the split command line tool - is there some way to use split to divide the large text file into the Y number of files as indicated in the larger single (doc or txt) file generated by LexisNexis?

share|improve this question

1 Answer 1

Split allows for a regexp pattern match so simply:

split -p pattern longfile.doc

Would start each new file when pattern was found. Nailing down which regexp matches your specific file might be better suited for http://stackoverflow.com but perhaps you know how to craft regexp and didn't realize split would match a pattern.

share|improve this answer
    
Unfortunately i am not familiar with either regexp or split. I found that one can use the command. Are you able to provide me with some more directions? –  wierts Nov 20 '13 at 17:44

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.