Matthew,
I am not sure this is best way but I am sure there is more than one way. I
presumed you are using a superior operating system (*nix) so
you could use the find utility to recurse through the directory tree finding
each *.html and executing a perl script that makes a backup of the original
file and then substitutes the changefrom text to changeto.
find /path/to/files -name *.html -exec perl -pi.bak -e \
's/changefrom/changeto/' {} \;
In your second message, I am not sure what part of the javascript you want to
change. Is it the following:
<img SRC="http://Vendor.com/server/ad/Companycom/CompanyMail/123"
and should change to:
<IMG SRC="http://www.Company.com/ads/default.gif"
If this is what you want put the vendor line in the changefrom (remember to \
the /)
<img SRC="http:\/\/Vendor.com\/server\/ad\/Companycom\/CompanyMail\/123"
and your replacement text in the changeto.
This isn't the most flexible approach as it is targetted to one specific string
but it should get the job done.
Best of luck,
Chris Dugmore
ps. advanced perl users should feel free to comment on this approach.
"Matthew J. Brooks" wrote:
> I trying to write a script to replace some multiline javascript code with a
> single <A HREF> tag. To compound this problem, I have to get the script to
> recurse through the directories so I don't have to execute it over and over
> for the hundreds of html (and htm) files in multiple directories on the
> webserver.
>
> I've tried various approaches, but I'm out of options (and time).
>
> Anyone have some input on how to best do this? Or maybe some scratch code I
> can tinker with?
>
> Thanks,
> Matthew
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com