do you have parts of strings with matching and not matching?

If you have gnu-grep then use a negative lookahead in regex as this with -P option:

grep -Pi 'errorcode(?!:null)' -A 10 -B 10 app.2020-.*

If you don’t have gnu grep then try this awk:

awk '/errorcode/ && !/errorcode:null/' app.2020-.*

it would require more bit of code in awk to match equivalent of -A 10 -B 10 options of grep.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top