Psl
Psl

Reputation: 3920

Sed command to replace a string in a file not working

While trying to execute below sed command from my VM

sudo -S shv6 <IP> "sed -i 's#<RDKBrowserHtmlViewItem>INFO</RDKBrowserHtmlViewItem>#<RDKBrowserHtmlViewItem>DEBUG</RDKBrowserHtmlViewItem><XREPluginGraphicsItem>DEBUG</XREPluginGraphicsItem>#g' /op/log.xml"

I observed following error message

sh: -c: line 0: syntax error near unexpected token `newline'
sh: -c: line 0: `sed -i s#<RDKBrowserHtmlViewItem>INFO</RDKBrowserHtmlViewItem>#<RDKBrowserHtmlViewItem>DEBUG</RDKBrowserHtmlViewItem><XREPluginGraphicsItem>DEBUG</XREPluginGraphicsItem>#g /op/log.xml'

Whats wrong with my sed command.

Upvotes: 0

Views: 399

Answers (1)

Psl
Psl

Reputation: 3920

Finally the below command worked.

sudo -S shv6 <IP> "sed -i 's#\\<RDKBrowserHtmlViewItem\\>LOG\\<\\/RDKBrowserHtmlViewItem\\>#\\<RDKBrowserHtmlViewItem\\>DEBUG\\<\\/RDKBrowserHtmlViewItem\\>\\<RDKBrowserHtmlViewItem\\>DEBUG\\<\\/RDKBrowserHtmlViewItem\\>#g' /op/log.xml"

Upvotes: 1

Related Questions