I have a long text data file structured in time frames, each delimited by a keyword (FLAG here) followed by its number, in this manner :
FLAG
1
... [data for frame 1]
FLAG
2
... [data for frame 2]
The number of lines of each frames is supposed to be fixed, however because of an I/O issue, some of them are shorter. I want to extract each frame to a separate file (frame_1.log, frame_2.log, etc...).
Using sed -n /FLAG/,{p;/^FLAG/q}
, I can print the content of the first frame, but is there a clean way to save each one to a new file?