I need to retrieve the lines which fall under the given date range.
eg:In a log file,i have the lines which will have the timestamp.
the input will be some date range.eg: from date:03/Jan/2008,to date:24/Jul/2008.so now i want to retrieve the lines
which have the timestamp between these 2 given date range.
log file:
[02/Jan/2008:19:37:00-20401-59-2] Process - data
[22/Jan/2008:19:37:00-20401-59-2] Process - data
[22/Mar/2008:19:37:00-20401-63-2] Process - data
[01/Jul/2008:19:37:00-20401-63-2] Process - data
[22/Jul/2008:19:37:00-20401-63-2] Process - data
[25/Jul/2008:19:37:00-20401-63-2] Process - data
result:
Lines 2,3,4 and 5 have to be retrieved. the dates are within the given input date range.
For the same query,if the input file is like this(below),I tried getting the lines by using the field separator (FS) as blank space.
I used the code like this..
BEGIN{
FS = "[ ]";
But its not working.How I can specify that it has to take the 7th field with the delimiter single space.or is there any other way.
Input file:
-----------
2008-01-02 16:21:35,182 INFO1 loginslogging - mk99263 02/Jan/2008 16:21 2008-01-22 16:21:35,182 INFO2 loginslogging - mk99263 22/Jan/2008 16:21 2008-03-22 16:21:35,182 INFO3 loginslogging - mk99263 22/Mar/2008 16:21 2008-07-01 16:21:35,182 INFO4 loginslogging - mk99263 01/Jul/2008 16:21 2008-07-22 16:21:35,182 INFO5 loginslogging - mk99263 22/Jul/2008 16:21
2008-07-25 16:21:35,182 INFO6 loginslogging - mk99263 25/Jul/2008 16:21