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

Re: How to read every 16 line of file ?

by SimonClinch (Chaplain)
on May 13, 2011 at 13:06 UTC ( #904660=note: print w/ replies, xml ) Need Help??


in reply to How to read every 16 line of file ?

perl -ne 'if ( ++$x == 16 ){ print $_; $x = 0; }' <filename

Update: but only if the rest of the logic is simple enough for inclusion in a one-liner like this.

update2: modified to shift target line nos to 16,32 etc. - a weird brainbug made me think 1,17 etc. was wanted - I need a holiday, lol!

One world, one people


Comment on Re: How to read every 16 line of file ?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-12-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls