I am trying to replace every occurrence in a .prm file of the string "/net/origin/devdata1/slin" with "/tools/common/test/HATS" in over a hundred files using sed. I think I am having trouble with the proper syntax for a for loop that loops through different files in a directory(/home/AutoTest), and what/if I need as command line arguments. Thanks in advance.
OLD="/net/origin/devdata1/slin"
NEW="/toolscommon/test/HATS"
DIR="/home/AutoTest"
for f in $DIR
do
cp $f $f.bak
sed 's+$OLD+$NEW+g' $f.bak > $f
[ -f "$f" ]
rm -f $f.bak
done