I read through the forum for clues how to solve my problem, but none of the related threads are useable for me, with limited programming knowledge, to apply to my specific problem.
My problem is this: I need to get rid of garbage lines that are clustered throughout my file, but are in between clusters of useable lines. I searched the sed manual and other informative sources about deleting ranges that match patterns, but they only mention to delete UNTIL match pattern, not TILL.
Now I would like to specify a range for which sed deletes lines starting from the first line that matches the pattern line till the line that matches the other pattern. Furthermore, sed needs to recognize the patterns that exists at the end of the lines.
For example:
line 1
blah blah 1
blah blah 2
blah blah 3
blah blah 4
line 2
line 3
Result needs to be:
line 1
blah blah 1
line 2
line 3
Please note the multiple lines between line and and line 2. While blah blah 1 needs to stay, the other 3 need to be deleted.
Thanks!