Date Range Problem

Posted by ungalnanban on Stack Overflow See other posts from Stack Overflow or by ungalnanban
Published on 2010-06-01T05:40:44Z Indexed on 2010/06/01 5:43 UTC
Read the original article Hit count: 272

Filed under:

I have a log file which has first few characters of every line as a timestamp.

2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message

2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message

2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message

2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message

2010-06-01 05:22:02,802 DEBUG {Thread-27} Some text message

2010-06-01 05:22:02,802 DEBUG {Thread-27} Some text message

2010-06-01 05:22:02,802 DEBUG {Thread-27} Some text message

2010-06-01 05:22:02,802 DEBUG {Thread-27} Some text message

2010-06-01 06:43:02,802 INFO {Thread-27} Some text message

2010-06-01 06:43:02,803 INFO {Thread-27} Some text message

2010-06-01 06:43:02,804 INFO {Thread-27} Some text message

2010-06-01 06:43:02,804 INFO {Thread-27} Some text message

2010-06-01 06:43:02,809 DEBUG {Thread-27} Some text message

2010-06-01 06:43:02,809 DEBUG {Thread-27} Some text message

2010-06-01 06:43:02,809 DEBUG {Thread-27} Some text message

2010-06-01 07:08:02,809 DEBUG {Thread-27} Some text message

2010-06-01 07:08:02,809 DEBUG {Thread-27} Some text message

My aim to find all such lines which have the timestamp of 1 hr before the current time.

How can this be achieved?

© Stack Overflow or respective owner

Related posts about perl