Multiple Search/Replace in one script?
Hi, I am looking for a way to automate (and also archive) my most common ten or twenty search/replace runs. I have to admit, I have no idea about scripting. But I guess there should be a way in Applecript/Perl/Rupy/Whatever to write down several entries with... ... what should be the search string ... what should be the replace string ... what kind of search should be opeated (regulr expression, case sensitive, etc.) Any recommendations? Steffen
On Sat, 26 May 2007, Steffen Wolfrum wrote:
Any recommendations?
MySQL ships with the "replace" command. I use most often "sed", for example "sed s/xxx/yyy/g old-file >new-file" Cheers, Peter -- http://pmrb.free.fr/contact/
On Sat, 26 May 2007, Steffen Wolfrum wrote:
Hi,
I am looking for a way to automate (and also archive) my most common ten or twenty search/replace runs.
I have to admit, I have no idea about scripting. But I guess there should be a way in Applecript/Perl/Rupy/Whatever to write down several entries with...
... what should be the search string ... what should be the replace string ... what kind of search should be opeated (regulr expression, case sensitive, etc.)
Any recommendations?
Most editors should be able to do this. I use vim, and most search replace is :s/search/replace/flags, and you can store common searches by either mapping them to keystores (F1, F2, etc, or sequence of keys) or writing functions or scripts and sourcing them. An advantage is that I can do a visual search/replace and manually confirm all changes. Sometimes this is easier than trying to figure out a regex that will take care of all cases. Aditya
participants (3)
-
Aditya Mahajan
-
Peter Münster
-
Steffen Wolfrum