I'm trying to replace this text in VIM
Actual Path /home/omipenguin/Servers\ Information/systemscript.sh/sysinfo.txt
with this new path
/home/sysinfo
I tried
%s/\/home\/omipenguin\/Servers\ Information\/systemscript.sh\/sysinfo.txt//home/sysinfo/g
but VIM gives me Pattern not Found
. What is wrong?
Best Answer
The forward slash
/
is used byvim
as the default pattern separator: it separates the pattern from the substitution you want to make, sovim
misconstrued the slashes in your path. You can specify another separator, like so:Note how you also need to escape the backslash
\
because of its special meaning in regular expressions.