Welcome to WebmasterWorld Guest from 220.127.116.11 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Pubcon Platinum Sponsor
mass edit .html files piplio msg:934775 10:42 pm on Jul 19, 2005 (gmt 0) hi there, i want to replace all the %24 in .html files into something like &, and i have about 300 of these .html files, how do i do a mass find and replace?
both windows and unix program is fine.
i know grep can find those... that's about it. thanks mm.
Corey Bryant msg:934776 4:09 am on Jul 20, 2005 (gmt 0)
Frontpage has a site wide search and replace as well as dreamweaver
ControlEngineer msg:934777 4:11 am on Jul 20, 2005 (gmt 0)
There are ways to do it using VBA, visual basic in an MS Office application such as Word or Excel. You might try to Google "Batch Replace" VBA for some code. Romeo msg:934778 10:07 am on Jul 20, 2005 (gmt 0)
... have you looked at the old unix 'sed', a simple but powerfull batch editor? Or a perl one-liner?
R. Romeo msg:934779 10:34 am on Jul 20, 2005 (gmt 0)
Here is a magic perl one-liner to change and replace all text strings "%24" to "&" in all of your *.html files in your current directory:
find . -type f -name "*.html" ¦ xargs perl -pi -e 's/%24/&/g';
Just type this on your unix console shell command prompt and you are done.
The character before the xargs is a vertical bar (unix pipe), just in case this forum software should mangle this character.
Caution: as this command will overwrite your files, test it first with some test files in a test directory and check the results, before you mangle your production files.
Disclaimer: although this command worked for me very well several times, you are using it at own risk.
Hope this helps.
R. dreamcatcher msg:934780 11:28 am on Jul 20, 2005 (gmt 0)
can you not just open all your files in a text editor and use the find/replace feature there? conText maybe? or Crimson Editor?