home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
src
/
xpm
/
rename
< prev
next >
Wrap
Text File
|
2000-07-29
|
613b
|
25 lines
#!/bin/sh
# rename is provided to easily update code using sed-command files
USAGE='rename sed-command-file file1 file2...
apply all sed-command-file to the files file1 file2
'
if test "$1" = '-?'; then echo "$USAGE";exit 1;fi
commands=$1
shift
for i in $*
do if test -f $i
then echo -n "$i: "
echo -n "."
sed -f $commands $i > /tmp/rename.sed.$$;
if test ! -s /tmp/rename.sed.$$; then rm /tmp/rename.sed.$$; exit 1;fi
if cmp /tmp/rename.sed.$$ $i >/dev/null; then echo
else cp $i $i.BAK; cp /tmp/rename.sed.$$ $i; echo " modified."
fi
fi
done
rm -f /tmp/rename.sed.$$ /tmp/rename.sed.$$.org