Make a script using the below. Then change to your highest folder and then run:
# sh name_of_script.sh *.htm
--------------
#!/bin/ksh
tmpdir=tmp.$$
mkdir $tmpdir.new
for f in $*
do
sed -e 's/action="" href="http://www.thesite.com/myScript.pl" TARGET="_blank">http://www.thesite.com/myScript.pl"/g'\
< $f > $tmpdir.new/$f
done
#Make a backup first!
mkdir $tmpdir.old
mv $* $tmpdir.old/
cd $tmpdir.new
mv $* ../
cd ..
rmdir $tmpdir.new
----------------------------
This script from the book "Unix for Oracle DBAs" by Donald K. Burleson by O-Reilly press (c) 2001. I highly recommend this book to anyone who uses that combination.
-----Original Message-----
From: Richard Crawford [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 23, 2003 3:48 PM
To: [EMAIL PROTECTED]
Subject: Shell Scripting Question
I have an urgent need inside a shell script to replace a filename within
an html file with the absolute url to the file.
For example, http://www.thesite.com/theform.html calls a CGI script. The
FORM tag looks like this:
< form name="thisForm" method="post" action="" >
What I need to do is create a shell script that will replace
action="">
with
action="" href="http://www.thesite.com/myScript.pl" TARGET="_blank">http://www.thesite.com/myScript.pl"
What's complicating this is that theform.html and myScript.pl are
replicated in hundreds of directories throughout the site, and
theform.html in each directory needs to be changed to reflect the local
copy of myScript.pl.
I hope that wasn't too confusing.
I've been pounding away at it all day and I have come no closer to a
solution.
Any ideas would be greatly appreciated.
--
Sliante,
Richard S. Crawford
http://www.mossroot.com
AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford
MSN: [EMAIL PROTECTED]
"It is only with the heart that we see rightly; what is essential is
invisible to the eye." --Antoine de Saint Exupéry
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list