Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Even and uneven numbers as RegEx

by broquaint (Abbot)
on Sep 27, 2004 at 11:30 UTC ( #394121=note: print w/ replies, xml ) Need Help??


in reply to Even and uneven numbers as RegEx

A one-line solution would be

perl -i.bak -ne 'print if $. & 1' filename
That will remove all even numbered lines in the file.
HTH

_________
broquaint


Comment on Re: Even and uneven numbers as RegEx
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-07-05 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls