Welcome to WebmasterWorld Guest from 54.198.100.0

Forum Moderators: open

Message Too Old, No Replies

mass edit .html files

     
10:42 pm on Jul 19, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:May 3, 2005
posts:41
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 28, 2004
posts:1786
votes: 0


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

-Corey

4:11 am on July 20, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Mar 9, 2004
posts:249
votes: 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 July 20, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 28, 2002
posts:505
votes: 0


... have you looked at the old unix 'sed', a simple but powerfull batch editor?
Or a perl one-liner?

Regards,
R.

10:34 am on July 20, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 28, 2002
posts:505
votes: 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.

Regards,
R.

11:28 am on July 20, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 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?