I have a large unix text file that is structured like this:
START
REF dqdqd
akjdljakldjalkdjalkjd
dkjlajdlakjdlakjdaskl
LINE dkjdlakjdaljd
LINE dajdlajdlajdldjd
TOTAL akjhadkhadkahd
kfdljakljdadlja
END
START
REF ddadasd
dkjlajdlakjdlakjdaskl
kfdljakljdadlja
END
START
REF
LINE dajdlajdlajdldjd
END
I need to somehow, within a korn shell script, extract the REF line, the LINE line(s) and the TOTAL line (if present) but ONLY if the LINE line(s) is present between a START and END
So in this example, my output would be
REF dqdqd
LINE dkjdlakjdaljd
LINE dajdlajdlajdldjd
TOTAL akjhadkhadkahd
REF
LINE dajdlajdlajdldjd
Can anyone help?
Start Free Trial