Raheel Hassan wrote:
Hi,

Hello,

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.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to