Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Returning line numbers of a string

by Old_Gray_Bear (Bishop)
on Aug 12, 2012 at 22:47 UTC ( #986989=note: print w/ replies, xml ) Need Help??


in reply to Returning line numbers of a string

In pseudo-code:

open log-file set line-counter to 0 read the log-file a line at a time add one to the line-counter if the pattern is found, then then print "I found pattern at ", line-counter once the file is completely read, close log-file print "We Are Done!!" exit
Let us know when you get stuck implementing this in Perl.

----
I Go Back to Sleep, Now.

OGB


Comment on Re: Returning line numbers of a string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2015-07-07 11:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls