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
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
64 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I want to split it out into separate files by the line prefix.. like this:
file 60 contains all lines prefixed with "60"
file 61 contains all lines prefixed with "61"
...
The best idea I came up with so far was to grep for all the line prefixes, then loop through that and grep each one of them out into a separate file, but it's a fairly large file, so that might take a really long time. Perhaps there is a better way than looping and grepping? Some way of grep grouping? I know there is a way to cut the file up if there were markers between each section like --- but I'm not entirely sure that's the best way either.
also, if there is some way to just do it in vim that's fine too – slf – 2014-07-15T21:13:59.363