0

I’ve tried several grep / egrep ideas with different options but none worked here. I’m trying to grep exact match of the pattern I’m looking in a log.

For example I want only a pattern “ERROR” to get grepped, rather than a word “ERROR123.”

I have two patterns to check Error/Exception. I’m looking for a solution where I can only grep, egrep, awk or sed the exact match.

Here is the update:

ERRCNT=`cat $LogFile | tail -c +$lastPosition | head -c +$difference | grep -qw "$EXPR1|$EXPR2"`
PATTERN=$ERRCNT 

if  [ -n "$ERRCNT" ]; then 

echo "$MSG : $PATTERN" 

exit 2;

else

echo "OK - NO ERROR CODES FOUND IN THE LOG"

exit 0;

fi;

When I see a pattern "Error / Exception" I need to get alerted. But when I have a pattern - Exceptioncase / Errornote. it also throws an exit2. I only need it on “Error / Exception.”

Any suggestions ?

Giacomo1968
  • 58,727

0 Answers0