Hi,
Using solaris 10 5.10 o/s
I am learning awk as I work here on the job.
What I need to do is isolate the trace file for the last 24 hours. After that I need to open those trace files and search for 'TNS-|ORA-' message from each one. These trace files MAY HAVE an occurance of them. I only need to recognize either one just once above before moving onto the next file otherwise it will become time consuming. The ultimate goal here is to do a total count (wc -l) for metric purposes. In other words if that line item includes the above it is to be counted.
So far this is what I got and would like to have some assistance or guidance as to how to complete this.
I generated the above list.
This is what I believe needs to happen next:
I need to loop thru this list, open each line using ‘more’ or ‘cat’ and do a "find" on 'TNS-|ORA-'. If it returns positive add it to the count.
count wc -l.
This part doesn’t work:
Any help or suggestions in this matter would be appreciated.
Thanks
al
Using solaris 10 5.10 o/s
I am learning awk as I work here on the job.
What I need to do is isolate the trace file for the last 24 hours. After that I need to open those trace files and search for 'TNS-|ORA-' message from each one. These trace files MAY HAVE an occurance of them. I only need to recognize either one just once above before moving onto the next file otherwise it will become time consuming. The ultimate goal here is to do a total count (wc -l) for metric purposes. In other words if that line item includes the above it is to be counted.
So far this is what I got and would like to have some assistance or guidance as to how to complete this.
Code:
ls -l /oracle/diag/rdbms/*/*/trace/*d00*.trc | grep 'Jan 20' | awk '{print $9}'
output:
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef _d000_21750.trc
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d000_22001.trc
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d001_22002.trc
This is what I believe needs to happen next:
I need to loop thru this list, open each line using ‘more’ or ‘cat’ and do a "find" on 'TNS-|ORA-'. If it returns positive add it to the count.
count wc -l.
This part doesn’t work:
Code:
| awk 'BEGIN {more *.trc;} {egrep 'TNS-|ORA-' *.trc} END | wc –l
Thanks
al