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 Answer
Use sed
and you needed to escape \
as it's special character:
sed 's/"/\\"/g' infile
-
1