I am looking for a command in sedthat converts this input stream:
dummy
(key1)
(key2)dummy(key3)
dummy(key4)dummy
dummy(key5)dummy))))dummy
dummy(key6)dummy))(key7)dummy))))
in that:
key1
key2
key3
key4
key5
key6
key7
where there dummycan be any line without parentheses. So I basically would like to extract the lines between the brackets and output one line per line. An optional closing bracket is possible ).
I have done many tests sedusing regex, but I cannot figure out how to solve this problem. Although I am sure that this is possible. (I am open to alternative tools like Perl or Python for example)
EDIT: The line between the brackets (key1, key2 .. key7) can be any line without parentheses.