replacecgi.sh

 

##!/usr/bin
 ###
 ### replace.sh
 ###
 ### Loop through every HTML file
 ### replacing old word w/new word.  
 ###
 ###

 if [ "$2" = "" ]
 then
    echo "Usage: $0 oldterm newterm"
    exit 1
 fi
 
 
 oldterm=$1
 newterm=$2
 
 
 for i in `find . -name \*.cgi -print`
 do
    if  `grep $oldterm $i >/dev/null 2>/dev/null` 
    then
       echo "Updating $i"
       sed "s/$oldterm/$newterm/g" $i > $i.tmp
       mv $i.tmp $i
    fi
 done