I have a big file of 5000+ lines which has a repeated pattern like shown below:
ABC
111
222
333
XYZ
ABC
444
555
666
777
XYZ
..
..
ABC
777777777
888888888
999999999
222
333
111
XYZ
I would like to extract contents between each 'ABC' and 'XYZ' and write it to a separate file.
Ex: file1 should have
ABC
111
222
333
XYZ
File2 should have
ABC
444
555
666
777
XYZ
Filen should have
ABC
777777777
888888888
999999999
222
333
111
XYZ
and so on.
How could we achieve this ? I read these below threads but it writes only one single file. Didn't help for my case.
How to select lines between two marker patterns which may occur multiple times with awk/sed