Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How to read every 16 line of file ?

by SimonClinch (Deacon)
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://904660]
help
Chatterbox?
[tye]: We use auditd for security monitoring. So we can rely on auditing being enabled. I'm not sure who would want to not be able to audit. Maybe some VM inside another system with audit?
[SuicideJunkie]: spies would want a system to not be able to audit.
[erix]: spies should use a type-writer, no power needed, no auditable
[erix]: if all else fails, eat the paper

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-06-23 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (555 votes). Check out past polls.