Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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.


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2015-11-25 22:20 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (692 votes), past polls