Re: Mass Replace
Andrew Kelly <[email protected]>
| Newsgroups | gmane.linux.redhat.release.enigma |
|---|---|
| Organization | Transparency International |
| Message-ID | <[email protected]> |
Faisal wrote: > > Hi, > > Is there any program can replace particular value from files. Like I > only define the path of folder and it can read each file inside the > folder and replace it with value I define. > > Like I need to change company name from over 200 files htmls with new > name how can I do that. > find (man find) will get you all the files you're talking about, and with -exec you can pass them on to any executable of your choice. I supposed sed would be enough to do the trick. I personally would do it in 2 passes, though, because I tend to break things when I'm trying to show off and do everything in a single command line. I'd let find write to a file the name of every file that contains the string I want to replace. Then I'd write a quick perl script that opens each file and replaces the string where appropriate. However you end up doing it, do it with copies of everything until you are certain it works the way you want. Shooting yourself in the foot is only fun a year later when you talk about it in group therapy. Andy > Regards, > > Faisal Ashraf > Manager Network Operations > Silk Internet Services > > _______________________________________________ > enigma-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/enigma-list -- Andrew Kelly IT Transparency International Otto-Suhr-Allee 97/99 10585 Berlin, Germany Tel: +4930 3438 2026, Fax: +4930 3470 3912 [email protected]