How to GREP unique string only?
595762Mar 20 2011 — edited Mar 20 2011Hi,
I have a huge import log file and it's too hard to review the full log file to verify all reported errors are ignorable. So I am looking for a way to list the distinct errors.
I had some manual analysis and workarounds to find out the errors however it consumes time and i am sure there are more easier way.
I will attach sample of the log file.
The log file ends with "Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 3384 error(s) at 11:38:14" which shows that we have 3384 error in the log file
I went through the file and found some errors and did simple word count command
[AMD64] ortissm2@ausodissm01 > cat full_import.log | grep ORA-39151 | wc -l
598
[AMD64] ortissm2@ausodissm01 > cat full_import.log | grep ORA-39111 | wc -l
1054
[AMD64] ortissm2@ausodissm01 > cat full_import.log | grep ORA-31684 | wc -l
1691
but there are 42 Error still missing .. I did the following workaround to prune the ORA-39151 grep ORA-39111 grep ORA-31684 redirecting the output to another file then search with the same for ORA- pattern
cat full_import.log | grep -v -e ORA-39151 -e ORA-39111 -e ORA-31684 >import.log
[AMD64] ortissm2@ausodissm01 > cat import.log | grep ORA-39083 | wc -l
1
[AMD64] ortissm2@ausodissm01 > cat import.log | grep ORA-29357 | wc -l
1
[AMD64] ortissm2@ausodissm01 > cat import.log | grep ORA-39082 | wc -l
40
SAMPLE LOG FILE
--=--
ORA-31684: Object type TABLESPACE:"UNDOTBS1" already exists
ORA-31684: Object type TABLESPACE:"SYSAUX" already exists
ORA-31684: Object type TABLESPACE:"TEMP" already exists
ORA-39111: Dependent object type TRIGGER:"SYSMAN"."SEV_ANNOTATION_INSERT_TR" skipped, base object type VIEW:"SYSMAN"."MGMT_SEVERITY_ANNOTATION" already exists
ORA-39111: Dependent object type TRIGGER:"SYSMAN"."SEV_ANNOTATION_DELETE_TR" skipped, base object type VIEW:"SYSMAN"."MGMT_SEVERITY_ANNOTATION" already exists
ORA-39111: Dependent object type TRIGGER:"SYSMAN"."SPACE_METRICS_PURGE_TRIGGER" skipped, base object type VIEW:"SYSMAN"."MGMT_SPACE_PURGE" already exists
ORA-39151: Table "WKSYS"."WK$_SYSINFO" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
ORA-39151: Table "WKSYS"."WK$_SOURCE_GROUP" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
--=--
Need to grep the unique ORA- error only, the output like hereunder
ORA-31684
ORA-39111
ORA-39151
If we able to amend the code to get the number of occurrence this will be perfect and safe time too
thanks in advance,