----- Original Message -----
From: "Rob Oravec" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: "Perl Beginners" <beginners@perl.org>
Sent: Sunday, September 11, 2005 7:13 AM
Subject: Re: Read txt file and use each line as regex and output matches to
file.
Chris Charley wrote:
<snip>
Lastly, you are opening a file for writing for each matched line in your
log file. It would be better to save your matches in a hash. Then you
would only need to open the OUT file once (for each different IP) instead
of opening and writing for each matched line. Just something to consider.
Hi Chris
The script as it stands is very inefficient because of the way I have done
it, you mentioned saving the matches or IP's in a hash how would I go
about doing this if you dont mind me asking?
Before now, I didn't understand exacly your problem concerning the append.
What you are saying is that every 'x' seconds, you want to re-read the log
file and only pick up the new entries (and not start from the beginning).
I have never done anything like this. I tried googling for this scenario and
didn't come up with anything, but I'll bet its out there.
If you could do this, I wonder how you would be able to read from the
resulting files (for further analsis) if they are being updated every few
seconds.
Chris
John W. Krahn wrote:
I don't understand why you are saying that the append option does not
workcorrectly. What exactly are you trying to accomplish?
Hi John!
Thanks,
The append option works correctly the first time and then continues to
append to the file every time I run it.
So in effect I'm getting the same log entries appear in the dump file
($date-$ip.log).
I will want to run the script every (x) seconds and dump each
router/firewall log to its own log file for further processing, if I could
get it to check from the last point in the $log_file even better but thats
for a later mission.
Thanks again for the help and tips!
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>