# ### tbl_link.sh ### ### Usage: ### ### tbl_link.sh reference phrase ### ### ### reference right now is an <a name tag in ### /usr/tomcat/webapps/ROOT/depot/oracle/test.html ### ### ### xdir=/usr/tomcat/webapps/ROOT/depot/dev if [ "$2" = "" ] then echo "Usage: $0 tag phrase" exit 1 fi file=$1 key1=$2 key2=$3 key3=$4 phrase=$key1 if [ "$key2" != "" ] then phrase="${key1} ${key2}" fi if [ "$key3" != "" ] then phrase="${key1} ${key2} ${key3}" fi for i in `find $xdir -name \*.html -print | grep -v "/$file" ` do if `grep -w "$grep" $i >/dev/null 2>/dev/null` then atag=`/usr/local/bin/atag.sh $i $grep` if `echo $atag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified atag" echo "$i" continue fi titletag=`/usr/local/bin/titletag.sh $i $grep` if `echo $titletag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified titletag" continue fi h1tag=`/usr/local/bin/h1tag.sh $i $grep` if `echo $h1tag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified h1tag" continue fi Atag=`/usr/local/bin/Atag.sh $i $grep` if `echo $Atag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified Atag" continue fi TITLEtag=`/usr/local/bin/TITLEtag.sh $i $grep` if `echo $TITLEtag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified TITLEtag" continue fi H1tag=`/usr/local/bin/H1tag.sh $i $grep` if `echo $H1tag | grep 1 >/dev/null 2>/dev/null` then echo "disqualified H1tag" continue fi p="http://www.setgetweb.com/skyway/map/depot/oracle/test.html#$file" echo " " echo "Creating link in:" echo " $i" echo " " echo "using the phrase: " echo " $grep" echo " " sed "s/ $grep / <a href=\"$p\">$phrase<\/a> /" $i | \ sed "s/ $grep\./ <a href=\"$p\">$phrase<\/a>\./" | \ sed "s/ $grep\,/ <a href=\"$p\">$phrase<\/a>\,/" | \ sed "s/ $grep(/ <a href=\"$p\">$phrase<\/a>(/" | \ sed "s/ $grep;/ <a href=\"$p\">$phrase<\/a>;/" | \ sed "s/ $grep\"/ <a href=\"$p\">$phrase<\/a>\"/" | \ sed "s/ $grep$/ <a href=\"$p\">$phrase<\/a>/" | \ sed "s/\.$grep;/\.<a href=\"$p\">$phrase<\/a>;/" | \ sed "s/<b>$grep<\/b>/<a href=\"$p\">$phrase<\/a>/" | \ sed "s/<i>$grep<\/i>/<a href=\"$p\">$phrase<\/a>/" | \ sed "s/<b>$grep,/<b><a href=\"$p\">$phrase<\/a>,/" | \ sed "s/$grep<\/b>/ <a href=\"$p\">$phrase<\/b>,/" | \ sed "s/($grep /(<a href=\"$p\">$phrase<\/a> /" | \ sed "s/\/$grep\'/\/<a href=\"$p\">$phrase<\/a>\'/" | \ sed "s/\/$grep\'/\/<a href=\"$p\">$phrase<\/a>\"/" | \ sed "s/\.$grep\"/\.<a href=\"$p\">$phrase<\/a>\"/" | \ sed "s/\"$grep\"/\"<a href=\"$p\">$phrase<\/a>\"/" | \ sed "s/ $grep$/ <a href=\"$p\">$phrase<\/a>/" | \ sed "s///\//g" > tmp.$$ mv tmp.$$ $i fi done