#!/bin/csh
# rename: a C shell script from Sobell "UNIX System V, A Practical Guide"
#
# Usage: rename arg1 arg2
#        changes the string arg1 in the filenames of files
#        in the working directory to the string arg2
#
if ($#argv != 2) goto usage
foreach i ( *$1* )
    mv $i `echo $i | sed -n s/$1/$2/p`
end
exit 0

usage:
echo "Usage: rename arg1 arg2"
exit 1
