Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Newbie Text Parsing Question

by Brovnik (Hermit)
on Jul 06, 2001 at 00:49 UTC ( #94275=note: print w/replies, xml ) Need Help??


in reply to Newbie Text Parsing Question

My version, editted from the first reply.
foreach my $fn (<*.log>) { # start with 3 entries to ensure 3 lines my @fifo = ('','',''); open I, $fn or warn("Couldn't open $fn: $!"), next; while (<I>) { #Add current line on one end and remove the first entry push(@fifo,$_); shift(@fifo); if (/monk/) { print '-'x40 ,$/; print "From file [$fn]:\n\n"; print @fifo; print '-'x40 , $/; } } close I; }

--
Brovnik

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://94275]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2016-12-05 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (71 votes). Check out past polls.