Two fixes are needed:
- Since you have
/
in your strings, it is recommended to use a different delimiter or you need to tell sed that it is not a delimiter by escaping them. - Since you are using variables, use double quotes to allow them to interpolate.
str1='http://gaa-dev.gk.gbcd:9701/analytics'
str2='https://gaa-prod.gk.gbvd/analytics'
echo 'http://gaa-dev.gk.gbcd:9701/analytics' | sed "s/$str1/$str2/"
sed: -e expression #1, char 11: unknown option to `s'
echo 'http://gaa-dev.gk.gbcd:9701/analytics' | sed "s|$str1|$str2|"
https://gaa-prod.gk.gbvd/analytics