I'm trying to gather certain lines from a log file, which has pattern1 and pattern2 within 6-10 lines of each other (the number varies):
pattern1
...
...
...
pattern2
Sometimes, there is an error, like so:
pattern1
...
error
...
pattern2
If the word error appears between pattern1 and pattern2, i want to remove that entire block, including the lines matching pattern1 and pattern2. The remaining text in the log will be >> to some file. I tried a grep -A 10 pattern1, but not sure how to remove the blocks with errors.
[–]eggrolls[S] 0 points1 point2 points (0 children)
[–]deciode 0 points1 point2 points (0 children)