I am trying to replace '' with '\' character using sed command
echo "F:\RDAR\P003\P003\20220701" | sed 's/ \ / \\ /g'
I don't know what's wrong with this command
I expect this 'F:\\RDAR\\P003\\P003\\20220704'
I am trying to replace '' with '\' character using sed command
echo "F:\RDAR\P003\P003\20220701" | sed 's/ \ / \\ /g'
I don't know what's wrong with this command
I expect this 'F:\\RDAR\\P003\\P003\\20220704'
You need to escape the backslashes, so \
becomes \\
:
sed 's,\\,\\\\,g'
or the slightly more hard to read for people with eyesight like my own:
sed 's/\\/\\\\/g'