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

Re^2: Search and replace within a file

by sriharsha.sm (Initiate)
on May 11, 2012 at 07:46 UTC ( #969927=note: print w/ replies, xml ) Need Help??


in reply to Re: Search and replace within a file
in thread Search and replace within a file

You can achieve the same in a perl one liner

$perl -e 's/old/new/ -pi.backup /etc/hosts
It does the inplace replace and takes a back up of the old files with .backup extension


Comment on Re^2: Search and replace within a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2013-05-23 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (478 votes), past polls