codice:
#!/bin/bash

function whelp()
{
	echo
	echo "   USE: sedfunc [list=1] <newstring> <extension>"
	echo
	echo "   the script replaces in all the files with the"
	echo "   <extension> extension [list=1] with <newstring>"
	echo
	echo "   if <extension> is not specified the program will"
	echo "   replace the string in all the files in the directory"
	echo
	echo "   other options:"
	echo "   -h, --help   display this help and exit"	
	exit 0
}

if [ ! "$1" ] || [ ! "$2" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
	whelp
else
	echo
	echo "replacing ..."
	
	if [ "$3" ]; then
		ext="*."$3
	else
		ext="*"
	fi
	
	for f in `ls $ext`
	do
		sed -e 's/'$1'/'$2'/g' $f > $f.new
	done
	
	for f in `ls *.new`
	do
	    mv $f `basename $f .new`
	done
fi

exit 0
semmai modificalo un po'

ah, lo vedo adesso, se lo vuoi fare ricorsivo usa
find -name $ext
invece di
ls $ext