linux - Filtering file in unix using grep/sed/awk other? -
i have gigantic error log files show errors encountered on dataload.
i need report errors not unique constrain violations, searching through files manually impractical due size.
the log file:
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 large column "dm"."dmt_address"."original_postcode" (actual: 12, maximum: 10) desired output file is
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 large column "dm"."dmt_address"."original_postcode" (actual: 12, maximum: 10) i'm pretty sure can done in grep, sed or awk, i'm new sort of thing...i'd appreciate pointer or two.
here possible solution using perl-regex (with negative lookahead) exclude ora-00001 , line before matching oras (-b1):
grep -b1 -p 'ora\-(?!00001)' logfile
Comments
Post a Comment