I have some scripts(linux) which are generating the o/p with respect to Windows. I expect it to be /home/manty/...
it generates \home\manty\...
It is very annoying when I try to change one by one all the time. So just for this purpose, I am leaving vim and going to gedit
to perform "find and replace". How can I do it in vim?
I tried with following :
:%s/\\/\/
It changed only in the two places. I tried several other combinations as well nothing is working out.
:%s/\\n//g will simply remove every instance of \n .
How do I insert a space + backslash at the end of the all lines in my Vim editor? Go to the end of the line, add space + backslash, go to the next line, add space + backslash, ... repeat.
Ah. I missed the g
thing.
:%s/\\/\//g
This command does the trick. g
stands for global and will make the change globally (complete file).
Also, you can add an extra option of c
if you want to monitor each change. If you want to use c
option the command would be :%s/\\/\//gc
and then select y
or n
for each change.
I will wait for better answers from vim geeks. I am sure there must be a better way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With