Having a scenario to replace the even and odd occurrence of backslashes by the number of quotient when dividing by 2.
For example
Input: (15 backslashes)
\\\\\\\\\\\\\\\
output: (7 backslashes)
\\\\\\\
Input: (14 backslashes)
\\\\\\\\\\\\\\
output: (7 backslashes)
\\\\\\\
I tried using sed command which is working for 4 backslashes to 2.
sed 's/\\\\/\\/g'
Appreciate if any help.