[wplug] replacing text within full website
Russ Schneider
russ at sugapablo.com
Tue Jan 6 06:20:19 EST 2004
On Mon, 5 Jan 2004, Gentgeen wrote:
Save this as a file named "replace" at the top of your directory
structure, then make it executable (chmod 755 replace):
#!/bin/bash
#
# usage:
# replace string1 string2
#
# replace recursively searches all files in the directory for string1
# and replaces each instance with string2
echo -n "Replace $1 with $2 along entire directory structure? (y/n): "
read answer
if [ $answer == "y" ]
then
for FILE in `grep -r -s -l $1 *` ; do
cp $FILE $FILE.new
sed s#$1#$2#g $FILE.new > $FILE
rm $FILE.new
done
fi
--
[ Russ Schneider (a.k.a. Sugapablo) ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ sugapablo at 12jabber.com <--jabber IM ]
More information about the wplug
mailing list