awk '$1~/Mon|Tue|Wen|The|Fri|Sat|Sun/{flag=1;string=$0} $1~/ORA/{if(flag==1) {print string;flag=0} print $0}' --------------------------------------------------------------------------------------------------------------------------------------------------------------------- #!/bin/bash RELEASE_DIR=/var/monitororacle REPORT=$RELEASE_DIR/ORA_error.`date '+%d%m%y'` OUTFILE1=$RELEASE_DIR/bin/tmp.out1 OUTFILE2=$RELEASE_DIR/bin/tmp.out2 OUTFILE3=$RELEASE_DIR/bin/tmp.out3 SYSEMAIL_APP="/var/monitororacle/bin/sendemail.sc" awk '$1~/Mon|Tue|Wen|The|Fri|Sat|Sun/{flag=1;string=$0} $1~/ORA-/{if(flag==1) {p rint string;flag=0} print $0}' $ORACLE_BASE/admin/topdb/bdump/alert_topdb1.log> $OUTFILE1 awk '$1~/Mon|Tue|Wen|The|Fri|Sat|Sun/{flag=1;string=$0} $1~/ORA-/{if(flag==1) {p rint string;flag=0} print $0}' $ORACLE_BASE/admin/topdb/bdump/alert_topdb1.log | grep `date | awk '{print $6}'` >$OUTFILE3 cat $OUTFILE1 |awk -F: '{print $1}'|awk -F- '{print $1}'|uniq -d >$OUTFILE2 if [ `sed -n '$p' $OUTFILE2` == "ORA" ] then touch $REPORT echo "============================================================== ======">$REPORT echo "`hostname`::Oracle ORA error : ">$REPORT echo "`cat $OUTFILE3` ">>$REPORT echo "PLS check it .." `ls -ltr $ORACLE_BASE/admin/topdb/bdump/ alert_topdb1.log |awk '{print $9}'` >>$REPORT echo "============================================================== ======">>$REPORT fi #rm $OUTFILE1 #rm $OUTFILE2 #rm $OUTFILE3 if [ -f $REPORT ] then $SYSEMAIL_APP $REPORT #rm $REPORT fi |