Date comparison with 'string date having slashes and time zone' in Bash only

  1. The problem statement, all variables and given/known data:
    I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format [31/Mar/2002:19:30:41 +0200].

I have developed a log analysis command line utility that displays different statistics from the log (like the IP with most connection attempts, the most common result codes etc.). In fact to view every stat the user will have to give a specific switch to my utility.

Now comes the problem; with every stat the user can ask to display the results for either 1. previous n hours. or 2. previous n days. I am unable to use the date from the file with format [31/Mar/2002:19:30:41 +0200] and make a comparison with the timestamp of previous n hours or previous n days.

Constraint: I have to attempt this is only in bash.

  1. School (University) and Course Number:
    Blekinge Institute of Technology
    MS Computer Science

Have you searched the forum?
This could give you some ideas or convince you "Its possible!"