1

substitution to mulitple files

view story
linux-howto

http://www.unix.com – Hello all, I am trying to make a script that will apply a substitution to any number of files given on the command line. Example would be ~/Unix/script/subst car boat myFile1.txt myFile2.txt myFile3.txt This is the code I have so far but it does not function as needed. Code: PAT=$1 shift REPL=$1 shift for FILE in $* do mv $3 $3.bak sed "s/$1/$2/g" $3.bak > $3 done Looking for any pointers. Thanks (HowTos)