I have a json string, which has a potpourri of doubly escaped/singly escaped newline chars. Json parser doesn't allow its string value to have single backslash escapes.
I need to uniformly make all of them to double escapes
Content looks like,
this newline must not be changed ---- \\n this newline must be changed - \n
When i run sed command,
sed -i 's/([^\])\n/\\n/g' ~/Desktop/sedTest
it is not replacing anything
([^\]), this pattern is used to not change
\n that already has one more backslash.