Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to replace this text in VIM

Actual Path /home/omipenguin/Servers\ Information/systemscript.sh/sysinfo.txt

with this new path


I tried

%s/\/home\/omipenguin\/Servers\ Information\/systemscript.sh\/sysinfo.txt//home/sysinfo/g

but VIM gives me Pattern not Found. Please advise, what is wrong?

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.