Hi,
I am trying to replace a URL by another URL in the SED command e.g.
cat dir/filename1 | sed -e 's/"http:\/\/[^ ]*dtd"/"http:\/\/abc.def.com\/xyz.dtd"/' > dir/newfile.xml
But I need to pass a parameter to the SED command which should have the new url string i.e. http:\/\/abc.def.com\/xyz.dtd
$NEW_URL=http:\/\/abc.def.com\/xyz.dtd
I tried
cat dir/filename1 | sed -e 's/"http:\/\/[^ ]*dtd"/"$NEW_URL"/' > dir/newfile.xml
but instead of passing the new url, the old url was replaced by string '$NEW_URL' i.e. the parameter did not get replaced by its value.
Please help me in finding how can this be achieved.
Thanks
dsrookie