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 musing on the Monastery: (6)
As of 2014-08-01 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls