Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: search and replace text in multiple files in a directory

by steelrose (Scribe)
on Apr 04, 2005 at 15:03 UTC ( #444707=note: print w/ replies, xml ) Need Help??


in reply to search and replace text in multiple files in a directory

It really depends on whether you want to actually open each file in the perl program itself, or let the OS do that for you. I do something similiar to the latter, where I make a system call: system ("sed 's/$searchString/$replacementString/g $filename > $newFilename'"); Note that I'm creating a NEW file with the changed text and not overwriting the original.

If you give a man a fish he will eat for a day. If you teach a man to fish he will buy an ugly hat. If you talk about fish to a starving man, you're a consultant.


Comment on Re: search and replace text in multiple files in a directory

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (16)
As of 2014-07-25 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (172 votes), past polls