Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含字符串的文件usrbin。我想搜索usrbin并将其替换为/usr/bin/.
usrbin
/usr/bin/
我试过:%s/usrbin/usr/bin/g了,但它显示错误E488: Trailing characters。
:%s/usrbin/usr/bin/g
E488: Trailing characters
如何在搜索和替换中包含正斜杠?
这里有两种方法:
/
:s/usrbin/\/usr\/bin
#
:s#usrbin#/usr/bin
"
\
|
您可以在帮助子系统中使用:h pattern-delimiter
:h pattern-delimiter