0

I have a pretty big json file and I would like to add the escape character in front of all quotation marks in it. For example I want to change: "CaptureDuration":0 to \"CaptureDuration\":0. I tried to substitute all " with \" in sed and vim but I guess due to the special type of the escape character it wasn't working properly.

1

Use sed and you needed to escape \ as it's special character:

sed 's/"/\\"/g' infile
  • 1
    it works, thanks a lot for the quick reply – Georgе Stoyanov Apr 4 '18 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.