I have a file with the following lines:
string
string
string
MODEL 1
.
.
.
TER
string
string
string
MODEL 2
.
.
.
TER
where there are 5000 such MODEL
s. I want to split this file such that each section beginning MODEL X
and ending TER
(shown with dots) is saved to its own file, and everything else is discarded. How can I do this? Possibly with awk
or split
?
I have checked a couple of other similar questions, but failed to apply the answers to my case.
Also note that I use Mac OS X.