replacea.sh

 

###
### replacea.sh
###
### Recurse through directory tree
### Replace oldstring with newstring
### in every text file
### 

oldstring=$1
newstring=$2

rm $HOME/viala.tmp 2>/dev/null
for i in `find . -name \*.\* -print`
do
     x=`file $i`
     if echo $x | grep text > /dev/null 2>&1
     then
         if grep -s "$*"  $i > /dev/null  2>&1  
         then
            
         fi
     fi
done
vi `cat $HOME/viala.tmp`