I have the below string in a file filename="mongo-template.txt"
.
db.EndpointUrls.insert({"BACKEND_APP" : "DCC", "APPLICATION_NAME" : "dcc-core-api", "COUNTRY_CODE" : "IN", "ENDPOINT_URL" : "SERVICE-ENDPOINT");
I need to replace SERVICE-ENDPOINT with https://test-in.mydomain.com/api/users
filename="mongo-template.txt"
serviceendpoint="https://test-in.mydomain.com/api/users"
$sed "s/SERVICE-ENDPOINT/$serviceendpoint/g" "$filename"
I am getting the below error.
sed: -e expression #1, char 27: unknown option to `s'.
- If the serviceendpoint contains
/
character, I am getting the error. - If the serviceendpoint does not contain
/
character, it replaces the string in the file.
The below link helped me to resolve my issue.