How to Replace Path in Search field using VIM
8,853
The forward slash /
is used by vim
as the default pattern separator: it separates the pattern from the substitution you want to make, so vim
misconstrued the slashes in your path. You can specify another separator, like so:
%s!/home/omipenguin/Servers\\ Information/systemscript.sh/sysinfo.txt!/home/sysinfo!g
Note how you also need to escape the backslash \
because of its special meaning in regular expressions.
Related videos on Youtube
Comments
-
OmiPenguin over 1 year
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?