Ask Different is a question and answer site for power users of Apple hardware and software. 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

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

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


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.