#!/bin/sh
#	replace string1 with string2 in any number of files
#	watch out for special characters/spaces in str1/2: protect them!!
#	by Nick Manini v. Feb 7, 2006
case $# in
0|1|2)	echo "usage: $0 str1 str2 file(s)\nreplaces str1 with str2 in file(s)";;
*)	script=`echo "s/$1/$2/g"`
	shift; shift
	for i
	do
		if (sed "$script" $i > /tmp/replace.$$)
		then
			mv /tmp/replace.$$ $i
			echo replaced in $i
		else
			echo "NOT replacing\07!!!" 1>&2
		fi
	done
esac





