homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

mass edit .html files

 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

 4:09 am on Jul 20, 2005 (gmt 0)

Frontpage has a site wide search and replace as well as dreamweaver



 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.


 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?



 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.



 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?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved