#!/bin/sh
function usage {
echo "Usage: $0 ORG_txt NEW_txt file file..."
}
if [ $# -lt 3 ]
then
usage
exit 1
fi
ORG=$1
NEW=$2
shift
shift
for i in $*
do
printf "Changing %-20s .... " $i
if [ -f $i ]
then
sed "s/$ORG/$NEW/g" > temp 2>/dev/null < $i && mv temp $i && printf "done! " printf "ERROR "
else
printf "NOTFILE "
fi
done