I have a file that contains the string usrbin
. I want to search for usrbin
and replace it with /usr/bin/
.
I tried :%s/usrbin/usr/bin/g
, but it's showing error E488: Trailing characters
.
How do I include a forward slash in a search and replace?
Here are two ways:
/
which is the default substitute separator: :s/usrbin/\/usr\/bin
#
character: :s#usrbin#/usr/bin
. Note that there are characters that you can't use as a separator: "
, \
, |