Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: range of lines

by delirium (Chaplain)
on Jun 21, 2004 at 15:20 UTC ( [id://368471]=note: print w/replies, xml ) Need Help??


in reply to range of lines

If you happen to want the matching line printed in addition to the 5 lines after it, you could use the .. operator like so:

perl -ne 'print if /PATTERN/ .. ++$c%6==0;' file.txt

Replies are listed 'Best First'.
Re^2: range of lines
by kesterkester (Hermit) on Jun 22, 2004 at 13:10 UTC
    Ahhh, that's a very clever way to do it. ++delirium!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found