How to replace a string with a variable in a file using sed?

I have a file having some text like:

PATH_ABC=/user/myLocation

I have to replace "/user/myLocation" with a session variable say, $REPLACE_PATH,
where $REPLACE_PATH=/user/myReplaceLocation

The following sed command is not working. It is writing PATH_ABC=$REPLACE_PATH in the file

sed 's#^PATH_ABC=.*#PATH_ABC=$REPLACE_PATH#' config.ini > newConfig.ini

I have replaced the delimiter slash (/) with hash (#) as the replace variable contains path delimiter as slash. Still it is not working,
Please help.

Try using double quotes instead of single quotes. And, reading these forums might have helped from the beginning.

1 Like

Thanks RudiC for your quick help. The double quotes worked absolutely perfect !