replaceaslash.sh

 

###
### replaceaslash.sh
###
### Recurse through directory tree
### Replace oldterm with newterm
### in every text file
### 

oldterm=$1
newterm=$2

for i in `find . -name \*.\* -print`
do
     x=`file $i`
     if echo $x | grep text > /dev/null 2>&1
     then
         if grep "$oldterm"  $i > /dev/null  2>&1  
         then
             echo "Updating $i"
             sed "s:$oldterm:$newterm:g" $i > $i.$$
             mv $i.$$ $i
         fi
     fi
done