Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: updating a file

by broquaint (Abbot)
on Nov 29, 2001 at 00:20 UTC ( [id://128165]=note: print w/replies, xml ) Need Help??


in reply to updating a file

While you've got the right idea by open()ing the file in read/write mode, it doesn't work quite as one would hope. You may want to try using the inplace command line switch like so
perl -pi -e 's/search_re/replace_re/g' $your_files_here
For more info on those lovely little switches check out the manual. Also you may want to be a little (see. A LOT) cautious of the infamous dot-star (i.e .*). You can learn of it's dodgy dealings from Ovid here.
HTH

broquaint

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found