I have a file test.txt, with contents like theese:
line random text 1 line random text 2 line random text 3 line particular exception line except detail 1 line except detail 2 line except detail 3 .... line random text 14 line random text 15 line random text 16 line particular exception line except detail 1 line except detail 2 line except detail 3 .....
I want to output (for further grep) the file contents filtering where "particular exception" appears, and filtering the "particular exception" details that appear AFTER it (allways 3 lines).
The logical command i thought of is this:
cat test.txt | grep -v -A 3 "particular exception"
But it doesn't work as i expected.
What is the correct way of doing this?
For some context, what i'm trying to do is to find exceptions in a log file EXCEPT a particular one that is constantly repeating itself, so first i want to clear it.