I have a file named config.yaml that contains this line:
device_connection_string: "<ADD DEVICE CONNECTION STRING HERE>"
I want to replace
<ADD DEVICE CONNECTION STRING HERE>
with the value of the following variable:
root@ubuntu1804-ko-001:/tmp# echo "$CSTRING"
HostName=PulseAzure-BetterTogetherDemo.azure-devices.net;DeviceId=ubuntu1804-ko-001;SharedAccessKey=xdWDu2gnzlg8X1mHgGqYU+yECBYUJ065n1AjdkYNCWI=
root@ubuntu1804-ko-001:/tmp#
When I run this sed command, I get the unterminated s error:
sed -i "s/<ADD DEVICE CONNECTION STRING HERE>/$CSTRING/g" config.yaml
sed: -e expression #1, char 38: unterminated `s' command
Thank you for your help!
CSTRING
have an extra trailing newline by any chance? Please edit your question to include the output ofecho "$CSTRING" | xxd
(being sure to include the quotes)