How to from grep command from a file which contains matching words?

Hi all

I have a file with below content (content is variable whenever new product is launched). I need form a grep command like this
egrep "Unknown product|Invalid symboland so on"
How to do it using a script?

Unknown product
Invalid symbol
No ILX exch found
exceeds maximum size
AFX Industry Code INT not found
time conversion error
DJ_Parser_Service::handle_not_found
Duplicate Key so rejecting

fgrep -f stringsfile targetfile

Hi...

I have this script below :

$ORACLE_HOME/bin/sqlplus "/as sysdba" @/ek_ora/script/rman_error.sh > rman_error.txt

more rman_error.txt | grep -i "FAILED" >> /ek_ora/script/rman_error.tmp
if [ ! -s "/ek_ora/script/rman_error.tmp" ]
then
echo "No error found."
else
echo "Sending mail."
mailx -r oraadm@jupp.gov.my -c encass@nc.com.my -s "RMAN Error" technical@precisionportal.com.my\
< /ek_ora/script/rman_error.tmp
fi

==================================

Based on that script it will grep "FAILED" only. If identified, the script will email to me...if else, it wont send any email..

My question is, in the file rman_error.txt, sometimes there will be another value i need to grep, i need to grep ERRORS and WARNING as well, so how to do this ???

If the file FAILURES.txt contains the things you want to grep for, then

fgrep -f FAILURES.txt rman_error.txt >> /ek_ora/script/rman_error.tmp

You could probably improve your script by avoiding the use of temporary files and using a pipeline instead.

sqlpus @stuff | fgrep -if FAILURES.txt | mailx -r whatever

That's just a proof of concept; it will send a message even when there are no errors.

Thanks era..It works the way I wanted