There are two files:
file1
:
dir='/root/path/to/somewhere/'
sed -zre "s|dir=(.*)'$|dir='$(echo $dir)'|g" -i file2
file2
:
dir='/blah/blah/'
I want to do this:
find a line having dir=(.*) and replace with the value of $dir
I run bash file1
, but it doesn't replace anything in `file21.