This is an extension of my previous question recommended by the answerer. Basically, I need sed to print text between delimiters. The delimiters could span multiple lines like:
(abc
d)
Below are sample input and output.
Input
(123)
aa (a(b)cd)) (g) (c)fff
abcd(aabb
d)aa (aeb)oe
correct output
123
a(b
aabb
d
Note: I only want the text between the first pair of delimiters. If the delimiter spans two lines than I just want the text between first pair that span two lines and move on to the third (next) line. Thus, for the last line in the input I printed 'd' and skip (aeb) and move on to the next line.