sed replace backslash double quote with single quote

I would like to take the following:

'{\"apiVersion\":\"apps/v1\", \"kind\":\"two\"}'

And end up with the following via using SED:

{'apiVersion':'apps/v1', 'kind':'two'}

>Solution :

Suggesting to try:

echo '{\"apiVersion\":\"apps/v1\", \"kind\":\"two\"}'|sed "s|\\\\\"|\'|g"

Result:

{'apiVersion':'apps/v1', 'kind':'two'}
  

Leave a Reply