Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 13 lines (12 sloc) 436 Bytes
# Replace word $1 with word $2 recursively in $3
# $ replace foo bar templates/
#
# This may fail with "bin/perl: Argument list too long" if the number of files
# found by `find` is too large. Make $3 more specific and run the script
# multiple times to get around this.
if [[ -n "$1" && -n "$2" && -n "$3" ]]
then
perl -e "s/$1/$2/g;" -pi $(find $3 -type f)
else
echo "usage: replace [to_replace] [replacement] [directory]"
fi
You can’t perform that action at this time.