How to grep by date range

Have you ever wonder how to grep a file within a date range?

[codesyntax lang="bash"]

cat file.log | sed -n '/2012-01-05 16:55/,/2012-01-05 18:30/p' > file.log.date_range

[/codesyntax]

1 Comentarii.

  1. Linus Tovoralds

    You'll get unexpected output if the ending date "2012-01-05 18:30" isn't in the file.log file.