: # chtext - change text within multiple files if [ $# -lt 3 ] then echo >&2 "usage: chtext old new [file ...]" exit 1 fi Old="$1" New="$2" shift; shift for file do echo >&2 "chtext: change $file: $Old to $New" if [ -r "$file" ] then if sed "s|$Old|$New|g" < "$file" > /tmp/ct$$ then mv /tmp/ct$$ "$file" else echo >&2 "chtext: could not change file: $file" fi fi done