Skip to content
Advertisement

Updating a yaml with a string containing special characters using sed

I have a yaml file that needs to be updated with string containing special characters. Here is the command I used but I get sed expression error

Yaml file (file):

JavaScript

Command that works without special characters for $var (env variable):

JavaScript

Value for $var:

fkugoiuhoiuyflkbbui/qy++bfv7J3c

Error I get is:

JavaScript

I am trying to figure out how I can get this working. Any help is greatly appreciated. Thanks!

Advertisement

Answer

The default delimiter of sed is conflicting with the / in your variable. You will need to set a different delimiter, further, the single quotes will not allow the variable to expand.

You can try this sed

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement