Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (20 sloc) 0.408 kb
#!/bin/bash
if [ $1 = -h ]
then
cat <<EOF
Usage: $0 exprssion [file ...]
Uses sed to replace the expression in all files.
Example:
$ replace 's:old:new:' *.py
EOF
exit 2
fi
sed_expr="$1"
# shifts all arguments, such that $2 is now $1 and $3 is now $2, ...
# such that $@ is now $2, $3, ... of the original arguments
shift
for x in "$@"
do
sed -e "$sed_expr" <$x >$x.tmp
mv $x.tmp $x
done
Jump to Line
Something went wrong with that request. Please try again.