Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Search and replace in all odd lines

by johngg (Canon)
on Jun 25, 2007 at 13:36 UTC ( [id://623170]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -i.bak -nle 's/search/replace/g unless $. & 2; print' file
  2. or download this
    line 1
    line 2
    ...
    line 7
    line 8
    line 9
    
  3. or download this
    $ perl -nle 'print unless $. & 2;' lines.txt
    line 1
    ...
    line 5
    line 8
    line 9
    

Log In?
Username:
Password:

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

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

    No recent polls found