---------- Forwarded message ----------
From: Raheel Hassan <raheel.has...@gmail.com>
Date: Sun, Dec 18, 2011 at 10:50 PM
Subject: Re: beginners Digest 19 Dec 2011 01:53:29 -0000 Issue 4280
To: beginners-digest-h...@perl.org, "John W. Krahn" <jwkr...@shaw.ca>


Thanks John,

Yes i do not have year field. Year is not the problem i have to match only
the date and time and that is working fine for me. I have problems in
handling the time because first initial time and end time will be entered
by the user but after how i can manipulate it because the time will
increase by the addition of one minute and so on till the end of file. I
thought a lot how to do it but did not get success.

Yes in my second entry i made a mistake. It is increasing by one minute.
For example :
Start time           End Time             Number of times word found.
First time in file
Dec  5 09:02:01      Dec  5 09:03:00      10
Second entry
Dec  5 09:03:01      Dec  5 09:04:00      5
Third entry
Dec  5 09:04:01      Dec  5 09:05:00      3

 I have 3 files (these are the log files of the system). These files have
> date formate like this (Dec  5 09:02:01).
>

Most date fields also have the year but your's doesn't appear to.  Are you
assuming the current year for all dates?


 I need to read these files from from the first date(Dec  5 09:02:01) till
> the last date (Dec 17 17:34:02) in the file. Then i have to search a word
> between the time difference of one minute and i have to count that how many
> times that word is present between these two time period.
>
> For example :
> Start time           End Time             Number of times word found.
> First time in file
> Dec  5 09:02:01      Dec  5 09:03:00      10
> Second entry
> Dec  5 09:03:01      Dec  5 09:03:00      5
> Third entry
> Dec  5 09:04:01      Dec  5 09:04:00      3
>

In your second and third examples the end time is less than the start time.
 How did that happen?


 and so on till the last entry of the date (Dec 17 17:34:02)
>
> How i can handle these dates. I have read about the Time::Local but that
> did not solve my problem.
> I will be very thankful for any help.
>

You need to convert the date field into some type of number or string that
can be easily compared.  Time::Local is just one module that can help you
do that.

Reply via email to