Print pattern range to a new file

Hi Everyone!

I really appreciate all of your help, I'm learning so much, can't wait until I get good enough to start answering questions!

I have a problem ... from one large file, I'd like to create multiple new files for each pattern block

beginning with /^ISA/
ending with /^IEA/

I'd even be happy with creating a new file for everything up to and including each occurence of ISA.

File is too big for csplit, I get a virtual memory exhausted error ... so I was thinking perl or awk? But I'm too new to both.

Again, I really appreciate your taking the time to help and answer questions

nawk '/^ISA/ {f=1;close(file);file="file"++c}f{print > file} /^IEA/{f--}' myHugeFile
1 Like

Thank you vgersh99 ... it works perfectly! I really appreciate your time and help.

I added -mr because the lines were too long and refined the search criteria. It ended up like this:

awk -mr 99999999 '/^ISA[^[:alnum:]_]/ {f=1;close(file);file="file"++c}f{print > file} /^IEA/{f--}'

Thanks again vgersh99!!