Hi All,
I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) -
/dd/pp/test/test/1/ /pp/aa/test/dg1/
/dd/pp/test/test/2/ /pp/aa/test/dg2/
/dd/pp/test/test/3/ /pp/aa/test/dg3/
This is how I am trying to get desired result-
cat /tmp/tt | while read LINE
do
FND=`echo $LINE | awk '{print $1}'`
REP=`echo $LINE | awk '{print $2}'`
sed "s=/${FND}=${REP}=" /tmp/ccf_temp.sql > /tmp/tmp.sql && mv /tmp/tmp.sql /tmp/ccf_temp.sql
done
Above is not working. However on command line if I give find and replace string directly, sed is working fine. For example below is fine
$>sed "s/dd/pp/test/test/1//pp/aa/test/dg1/=" /tmp/ccf_temp.sql > /tmp/tmp.sql
So I believe it is the variable that is cauing issue.
Can someone help please.
Thanks in advance for your time