1

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 
  • 1
    May be this will help you http://unix.stackexchange.com/questions/80088/how-to-find-files-by-the-time-in-their-filename/80089#80089 – cuonglm Jun 23 '13 at 17:43
  • You might be able to use my answer [here](http://serverfault.com/a/102531/1293) as the basis for what you need. – Dennis Williamson Jun 24 '13 at 01:53

1 Answers1

2
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.

glenn jackman
  • 4,320
  • 16
  • 19