blob: a767d5e3e06373266851d9fe591e938007395c91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/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
|