As a regular act , I need to monitor a file for some specific error messages.
file name is : alert_ORACLE.ora
in the last 1000 lines of the above mentioned file,am exactly looking for some messages like ORA- or ORA
.. then the
For example.. a alert log will contain : (errors like this ).. where ORA-07445 is the error am looking for ..then it has to print 3 lines above the error line and 2 lines below the error line.. want to send this output to a mail..
Thu Sep 6 03:39:04 2007
Errors in file /d01/oraprod/proddb/9.2.0/admin/udump/prod_ora_16214.trc:
ORA-07445: exception encountered: core dump [snstimsane()+54] [SIGSEGV] [Address not mapped to object] [0x0]  
currently I have this script to count the no of errors :
#script used to monitor the database alert log file
RETURN_CODE=`grep ORA-* /d01/oraprod/proddb/9.2.0/admin/bdump/alert_PROD.log | wc -l`
if [ $RETURN_CODE -eq 0 ]
subject:$(date +%d-%b-%Y-Time:%H:%M:%S) Database Alert log errors
$(echo "PROD - There are $RETURN_CODE errors in Alert log")