I think it should check the date condition first. here is how i get the outfile as:
2010-11-20 14:59:39,960 ERROR
Shipment Error Log:Error Details - Account Id:3962, PO:2573485, Line:2, File:221115901, Version:V1, Desc:Order cannot not be shipped as there are no line items in New s
2010-11-18 15:00:06,236 ERROR
Shipment Error Log:Error Details - Account Id:7238, PO:2591168, Line:2, File:221116801, Version:V2, Desc:Order cannot not be shipped as there are no line items in New s
2010-11-19 15:05:06,250 ERROR
Shipment Error Log:Error Details - Account Id:7238, PO:2591168, Line:2, File:221116801, Version:V2, Desc:Order cannot not be shipped as there are no line items in New s
2010-11-18 20:20:25,250 ERROR
Shipment Error Log:Error Details - Account Id:7238, PO:2591168, Line:2, File:221116801, Version:V2, Desc:Order cannot not be shipped as there are no line items in New s
if you see, it is not checking the date, but only the time. Is it possible to first locate the occurance of the first record satisfying the condition i.e, sysdate-time - 4hrs and copying the logs till end of file?
---------- Post updated at 05:16 AM ---------- Previous update was at 05:00 AM ----------
Thanks Kevintse, your second command saved us! it works wonders for us now...
I just noticed that my dummy log file contained dates jumbled up, so it was not fetching the correct records. But trying with a real log file, it worked!!.
Can you please explain how does this work?
BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s));