#!/usr/local/bin/bash # # replace.sh # Quick and dirty replace tool # # Zoidial, Inc. # Eric Thern, 2001, eric@zoidial.com # # # find test -type f -exec ~/replace.sh ddd lol {} \; # some new features at some point? # # v0.1 3/11/2001 - initial release # v0.1 11/7/2001 - tidied up help output if test "$1" = '' then echo "USAGE:" echo "------" echo "replace text-to-replace text-to-add file" echo "----------------------------------------" echo "example:" echo "replace 127.0.0.1 localhost /var/log/messages" echo "" else echo "replacing text $1 with text $2 on file $3" sed -e "s/$1/$2/" $3 > $3.rplzz cat $3.rplzz > $3 && rm $3.rplzz echo "done!" fi