#!/bin/bash
dirdo ()
{
cd $1
pwd
for fl in *; do
if [ -d $fl ]; then
dirdo $fl
cd ..
elif [[ $fl == *.txt ]] || [[ $fl == *.text ]]; then
mv $fl $fl.old
sed 's/find/replace/g' $fl.old > $fl
else
continue
fi
done
}
dirdo $1