in reply to Optimise the script

Instead of converting every single timestamp from your logfile, generate a single timestamp ($converted_date) that matches your log format , and use it to do string comparison instead of date calculation

Replies are listed 'Best First'.
Re^2: Optimise the script
by Anonymous Monk on Mar 30, 2011 at 12:03 UTC
    To elaborate, here is a c-program way of doing this
    $ date -d "2 days ago" "+%e/%b/%Y" 28/Mar/2011 $ grep "28/Mar/2011" input.txt
    or combine it (might not work on every shell)
    $ grep `date -d "2 days ago" "+%e/%b/%Y"` input.txt