我有巨大的錯誤日誌文件,顯示在dataload上遇到的錯誤。使用grep/sed/awk other在unix中過濾文件?
我需要報告不是唯一約束違規的錯誤,但由於它們的大小,手動搜索文件是不切實際的。
日誌文件:
Record 1: Rejected - Error on table DMT_.
ORA-00001: unique constraint (DM.DMT__PK) violated
Record 2: Rejected - Error on table DMT_.
ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE")
Record 3: Rejected - Error on table DMT_.
ORA-00001: unique constraint (DM.DMT__PK) violated
Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE.
ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10)
所需的輸出文件是
Record 2: Rejected - Error on table DMT_.
ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE")
Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE.
ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10)
我敢肯定,這可以在grep的完成,awk或者sed,但我是新來的這種的東西......我真的很感激一兩個指針。
絕對完美!感謝你和所有人! – Nimbocrux