Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a log file which has entries like below. I want to find only the log entries newer than a given time. What would be a suitable shell script for it?

[2013-06-23 21:31:19,972]  INFO 
[2013-06-23 21:31:20,148]  INFO 
[2013-06-23 21:31:20,148]  INFO 
[2013-06-23 21:31:20,195]  INFO 
share|improve this question
May be this will help you… – cuonglm Jun 23 '13 at 17:43
You might be able to use my answer here as the basis for what you need. – Dennis Williamson Jun 24 '13 at 1:53
up vote 2 down vote accepted
awk -v giventime="2013-06-23 21:31:20,150" '$1" "$2 < "["giventime"]"' logfile

If you want to specify the "given time" in a different format, we can accomodate you, but let us know.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.