This question already has an answer here:
I am trying to remove all instances of a pattern match from a file if it matches a pattern. If there is a match, the (complete) line with the matching pattern and the next line get removed.
The next line always appears after the line with the pattern match, but in addition it appears in other areas of the file.
I am using grep and it is deleting all occurrences of the next line in the file, as expected.
Is there a way I can remove that next line if and only if it is after the line with the pattern match?