|Perl Monk, Perl Meditation|
pattern match or key problemby brassmon_k (Sexton)
|on Jul 10, 2001 at 01:02 UTC||Need Help??|
brassmon_k has asked for the
wisdom of the Perl Monks concerning the following question:
Fellow Monks I need your brain power,
I've been doing PERL for like 6 months and I'm not that good at regular expressions such as for pattern matching. I'll show you the script I have first. Then show you the data it needs to read and show you what I want out of it. Here is the script.
Okay "mon402.log" is the file I'm trying to pattern match in. I left the "$" out at the end of the pattern match line as it kept me from returning anything including errors, I'd just get my prompt again. Now if I leave it off I get the following errors
Argument "27-Jun-2001 00:23:59.37 D:19208797684 O:19209891234" isn't numeric or ge line 27 I think it's reading the whole line when it finds the time but it isn't even finding times in the time range I specify I'm lost. It will show all times with the error I listed just before. I think my pattern matching is wrong or the way I pushed the data off through the arrays and keys is screwed up.
The print statements at the bottom are just to see what prints out for the values given. Now here is the type of information in the "mon402.log".
Now what I need is for the script to be able to match a time range on the second field right after the date. So when I give it a range such as -
I want the script to print the first 3 fields of each line inbetween the time I specified from STDIN. I looked on the web and in books for days but I can't seem to find an example of pattern matching internal to a file. External I can do but I've never done internal matching before and I'm not that good at regular expressions atleast the ones as complex as I need mine to be in order to search the way I want.
I relish the answer to this problem
Edit: chipmunk 2001-07-09