hi
i have a file with this line:
variable=/export/home/oracle
I want to change the file so that the path is replaced with the value of another variable
var2=/tmp/anything.
how to do this in sed?
thx
hi
i have a file with this line:
variable=/export/home/oracle
I want to change the file so that the path is replaced with the value of another variable
var2=/tmp/anything.
how to do this in sed?
thx
sed 's_variable=/export/home/oracle_variable='$var2'_'
Regards
I tried this so far (the line after variable= should be replaced with /tmp/anything):
sed -e "/^variable=/s/=.*$/=\/tmp\/anything\//" filename
this works.
But I can't make it when I replace /tmp/anything with $var2
Something like this?
sed 's_\(variable=\).*_\1'$var2'_'
sed 's_\(variable=\).*_\1'$A'_' filename
sed: command garbled: s_\(variable=\).*_\1/tmp/anything_
moreover, I prefer to use sed -e since I have several other subsitutions and I want to add this also.
thx