Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re3: Finding and extracting lines of text

by swkronenfeld (Hermit)
on Jul 30, 2003 at 16:58 UTC ( [id://279261]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Finding and extracting lines of text
in thread Finding and extracting lines of text

so just throw away the first two lines. Here's a quick fix on ajdelore's code

$success = 0; open(FILE,"dumptape.log") or die ("Could not open file"); while(<FILE>) { if (/Dump phase number 3/) { print; <FILE> for (1..2); print <FILE>; $success = 1; last; } } if(!$success) { print "Failed dump log\n"; #do other failed dump log stuff here } close FILE;

It seems like you have an understanding of some areas of perl, but are lacking some of the basics. You should look for an online tutorial (or better, one of the O'Reilly books), to pick up on a few of the little things you're missing.

Replies are listed 'Best First'.
Re: Re3: Finding and extracting lines of text
by mikevanhoff (Acolyte) on Jul 30, 2003 at 21:09 UTC
    I really appreciate all of the help. I have been searching the O'Reilly books for some of the basics I must have missed, but no where can I find a reference to my problem. The code presented here has been a great help in finding the first line I am searching. However, I am not sure that I am making my clear. I do need to find the line, but it is the NEXT LINE I need to print. THEN I need to SKIP 2 Lines and print the third. It is the skipping lines part that I am having problems doing. It seems logical that calling the <FILE>; on a line would read in the next line, but it does not appear to work. If this is still not clear, please let me know. I do not want to waste anyone's time. I can be email privately at mikev@beverlycorp.com Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found