Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Welcome to the Monastery
 
PerlMonks  

Re: range of lines

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 09: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.