Possible Duplicate:
Show only text between 2 matching pattern
In a bash script using sed how can I remove a block of lines beginning with -pattern a- and ending with -pattern b- where the the contents contains -pattern c- ( or does NOT contain -pattern c-)?
So :
line 1 -pattern a-
line 2
line 3 -pattern b-
line 4 -pattern a-
line 5 -pattern c-
line 6 -pattern b-
In this example I want to remove lines 4,5 and 6 (or remove 1,2 and 3 for not containing -pattern c-).