KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to grep all the lines between 2 date ranges , where the dates are formatted like this : date_time.strftime("%Y%m%d%H%M") so say between [201211150821 - 201211150824] I am trying to write a script which involves looking for lines between these dates: cat <somepattern>*.log | **grep [201211150821 - 201211150824]** I am trying to find out if something exists in unix where I can look for a range in date. I can convert dates in logs to (since epoch) and then use regular grep with [time1 - time2] , but that means reading each line , extracting the time value and then converting it etc . May be something simple already exist , so that I can specify date/timestamp ranges the way I can provide a numeric range to grep ? Thanks! P.S: Also I can pass in the pattern something like 2012111511(27|28|29|[3-5][0-9]) , but thats specific to ranges I want and its tedious to try out for different dates each time and gets trickier doing it at runtime.
Tags (comma-separated)
Save Edits
Cancel