Unix/Linux Go Back    

Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here.

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

Homework & Coursework Questions

Thread Tools Search this Thread Display Modes
Old Unix and Linux 10-07-2009   -   Original Discussion by TariqYousaf
TariqYousaf TariqYousaf is offline
Registered User
Join Date: Oct 2009
Last Activity: 9 December 2009, 4:55 PM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question 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.

2. School (University) and Course Number:
Blekinge Institute of Technology
MS Computer Science
Sponsored Links
Old Unix and Linux 10-08-2009   -   Original Discussion by TariqYousaf
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Join Date: Sep 2005
Last Activity: 18 November 2017, 9:50 AM EST
Location: Switzerland - GE
Posts: 6,479
Thanks: 289
Thanked 553 Times in 515 Posts
Have you searched the forum?
This could give you some ideas or convince you "Its possible!"
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
date comparison in bash carp.dk Shell Programming and Scripting 6 07-17-2009 10:44 AM
Date comparison in file to system time zainravi Shell Programming and Scripting 3 03-06-2009 03:48 AM
Simple date and time calulation in BASH ripat Tips and Tutorials 0 10-08-2006 07:15 AM
Help needed - Replacing all date & time occurrences in a file with a string using Sed Hema_M Shell Programming and Scripting 4 11-17-2005 01:42 AM

All times are GMT -4. The time now is 12:00 AM.