I try to grep all the lines between two date ranges where the dates are formatted as follows: date_time.strftime ("% Y% m% d% H% M"), so to speak, between [201211150821 - 201211150824]
I am trying to write a script that involves searching for strings between these dates:
cat <somepattern>*.log | **grep [201211150821 - 201211150824]**
I am trying to find out if something exists on unix where I can find the range in date.
I can convert dates to logs in (starting from an era) and then use regular grep with [time1 - time2], but that means reading each line, extracting the time value and then converting it, etc.
Maybe something simple already exists so that I can specify date / timestamp ranges, how can I provide a numerical range for grep?
Thanks!
PS: I can also pass something like 2012111511 (27 | 28 | 29 | [3-5] [0-9]) into the template, but this is specific to the ranges I want, and it is tedious to check different dates every time and it gets harder doing it at runtime.
codeObserver
source share