Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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?
[Lady_Aleena]: shmem, sorry I was outside for a moment moving my car out of hubby's way.
[Lady_Aleena]: shmem, there is ONE song which throws a wrench in the works for both MP3::Info and MP3::Tag.
[shmem]: Lady_Aleena: fix it, or delete it ;-)
[Lady_Aleena]: shmem, I'm not sure how.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-04-23 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.