I am trying to run this
sed -i -e "s/'(\${RConstants\.staticPath}\/dist\/img\/app\/icons\.svg#[a-z_-]*)'/`\1`/g" test
Single quote version
sed -i -e 's/'\''(\${RConstants\.staticPath}\/dist\/img\/app\/icons\.svg#[a-z_-]*)'\''/`$1`/g' test
Content of test file:
useElem.setAttributeNS(null, 'href', '${RConstants.staticPath}/dist/img/app/icons.svg#rsvg__ui--play'); useElem.setAttributeNS(null, 'href', '${RConstants.staticPath}/dist/img/app/icons.svg#rsvg__ui--play');
useElem.setAttributeNS(null, 'href', '${RConstants.staticPath}/dist/img/app/icons.svg#rsvg__ui--play');
Basically I need to replace single quote with back tick.
The problem is that I tried doing the sed
command with single quotes and with double quotes, each having its own problem.
With double quotes, I'm getting 1: command not found
and with single quotes, it doesn't replace anything.
Problems were 2:
Unescaped backticks (Those are used to spawn a new process) Unescaped parenthesis, so after fixing the backticks, the error was about not having a capture group.
So this worked OK.