replaceslash.sh

 

##!/usr/bin
 ###
 ### replaceslash.sh
 ###
 ### Loop through every HTML file
 ### replacing old w/new  string
 ###
 ###
 ### To avoid permissions problems, run as root
 ###

 if [ "$2" = "" ]
 then
    echo "Usage: $0 oldterm newterm"
    exit 1
 fi
 
oldterm=$1
newterm=$2

 
 
 for i in `find . -name \*.htm* -print`
 do
    echo $i
    if  `grep $oldterm $i >/dev/null 2>/dev/null` 
    then
       echo "Updating $i"
       sed "s:$oldterm:$newterm:g" $i > $i.tmp
       mv -f $i.tmp $i
    fi
 done