Extracting Log File data for a given date rangeby vishi (Beadle)
|on Dec 13, 2011 at 12:37 UTC||Need Help??|
vishi has asked for the
wisdom of the Perl Monks concerning the following question:
I have a really interesting situation here. I have a log file (basically a CSV) where each line is something that's got to do with a user's session. Each of these lines has a timestamp. A Sample is given below:
Now, here's what am trying to do - My program accepts 2 dates as command line args, the first arg is the start date and the second one is the end date. Something like this :
Now, I need to extract only those lines from the above CSV file which fall in this date range. I'm confused how to go about this one. I have thought of the following approach:
I need to know whether this is the right approach, or whether Perl has better tricks up its sleeve to make my job easier. I am familiar with Date::Calc, but I don't know how it will be useful here. If what I have thought of is correct, How do I go about "expanding" the date range, i.e., in my example, how do I convert 01-Dec-2011 11-Dec-2011 to a list with individual dates as its elements?