I am currently matching an Exception from a file and outputting 10 lines before and after use:
grep -C 10 "[. * Exception"
But now I want to exclude some specific exceptions, say AAAException and BBBException , how could I do this? This can be done through
grep -v "AAAException" | grep -C 10 "[. * Exception"
But if inside the file I have an AAAException within 10 lines from some other exception, this line will not be included in the output, which is not what I want. How can I not match an AAAException , but if it occurred 10 lines from some other exception, will it still be included in the output?
source
share