I have a file like this:
1,2,subjects,\mat\hs,unix\,\Nato,\N,123,\N
I want to replace all occurences of \ with #, except for \N, such that the output looks like this:
1,2,subjects,#mat#hs,unix#,#Nato,\N,123,\N
I am trying to write a sed command which looks like-
sed -e 's@\\([^N])@#\1/g' filename
but this will fail for all values wherever there is a \N at the start for ex. \Nato
in above example.
Could somebody please help me figure out a sed command(regex) for my requirement.