Link to home
Start Free TrialLog in
Avatar of CGettler
CGettlerFlag for United States of America

asked on

How do I Change Text in a bunch of documents with a script

I currently have approx 300 html documents that need to be modified. Rather then opening every one of these in Dreamweaver and manually changing them I had hoped for a script to do this.. I just need to replace the line <td width="18%" nowrap="nowrap" bgcolor="#F0F0F0" class="SubCats">Material:</td>

with
<td width="18%" nowrap="nowrap" bgcolor="#F0F0F0" class="SubCats"><strong>Material:</strong></td>

By putting Strong in the proper area.

Does anyone know of a script that can do this automatically for me.

Thanks

Chip
Avatar of SStory
SStory
Flag of United States of America image

There are many Unix style tools that can do this:

sed (which is now available on Windows)
http://gnuwin32.sourceforge.net/packages/sed.htm

Another one, for whatever reason is called FART (find and replace text)
http://fart-it.sourceforge.net/
It would probably be the simpler one, but no where near as powerful.
ASKER CERTIFIED SOLUTION
Avatar of SStory
SStory
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of magento
magento

In SSH ,go to path where u have all the codes and paste the above command one by one / or save the code in a file named - rename.sh and run chmod 777 rename.sh .

Run the script as below
./rename.sh