I want to replace / with // except /N So I got so far
sed ‘s/\\/\\\\/g’
But I’m not sure how to add ignore
CodePudding user response:
You can try
echo '\ \n \\n' |
sed -E 's/\\(n)|(\\)/\\\1\2/g'
\\ \n \\\n
CodePudding user response:
You could try this 's/\/\([^N]\)/\/\/\1/'
Simple match /
and the character after, requiring to not match N
character.
The matched character (other from N
) will be stroed in captureing group and can be used in replacement with \1
:)
Results from sed.js.org: