我有巨大的错误日志文件,显示数据加载时遇到的错误。
我需要报告不是唯一违反约束的错误,但是由于文件的大小,手动搜索文件是不切实际的。
日志文件:
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、sed 或 awk 中完成,但我对这类事情不熟悉......我真的很感激一两个指针。