Help with simple RegEx on grep

Hello,

I am trying to grep my log files for ORA errors, except ORA-00001.
I have tried:
grep 'ORA*!(-00001)' *.log
but it is not working.

Any help will be much appreciated.
Thank you.

Try:

awk '/ORA/&&!/ORA-00001/' file
1 Like
sed -n '/ORA-[0-9][0-9]*[^00001]/p'
1 Like

@ygemici. That will not work ( [^00001] is equivalent to [^01] ):

$ echo ORA-00011 | sed -n '/ORA-[0-9][0-9]*[^00001]/p'
$

Try this:

sed '/ORA-00001/d;/ORA/!d' infile
1 Like

thanks friend :slight_smile: i have written this urgently i have forgotten other conditions..
however if we only except `ORA-00001` we can use this

sed -n '/ORA-/{;/00001/!p;}' infile

regards
ygemici

1 Like
grep 'ORA' *.log |grep -v "-00001"
1 Like