Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Looking for a string from a huge log file

by pvaldes (Chaplain)
on Sep 13, 2012 at 21:08 UTC ( #993579=note: print w/ replies, xml ) Need Help??


in reply to Looking for a string from a huge log file

Not my intention to be rude, but delete this script, think a little in what do you want to do and try again. Seriously, is very poor.

For example: You claim to have a big file, Well, you are chomping each same line of this huge file up to three times. So your script is very bussy... doing nothing. If you need to delete a special input separator redefine $/

Don't apply four lines of regex if you want to delete a line containing "my pattern". Use "grep-not" (grep !/my pattern/, FH) instead.

keeps on printing the same string for all the other ID's

because $_ is not changing at all in the last lines. The loop has finished when you print to outfile so you only have the last matched line of your log in $_.

can you explain a little what do you need to do?

while(<MYINPUTFIL3>){

Try to keep it simple and readable, filehandles don't need to be complicated:

while(<LOG>){


Comment on Re: Looking for a string from a huge log file

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-08-01 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (52 votes), past polls