Skip to content

Instantly share code, notes, and snippets.

@dylan-k
Last active December 22, 2015 19:09
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 dylan-k/6517987 to your computer and use it in GitHub Desktop.
Save dylan-k/6517987 to your computer and use it in GitHub Desktop.
split one text file into many

if you want to split one text (or html or similar) file into many, here's a trick:

split -p '^plop' file.txt newfile-

...will split file.txt whenever a line starts with 'plop', into files with names like newfile-a, newfile-b, newfile-c, and so on...

I'd love to get it to create numbered files, instead of lettering them a, b, c for extra credit, I'd love to change the filename to be the first line of text

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