本文共 914 字,大约阅读时间需要 3 分钟。
vi,在command line 模式 :%s/$/ abc/ abc为要添加的字符串 :%s/$/ abc/gc 逐行添加,c表示确认是否添加
更详细可见
The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want: :%s/foo/bar/g Find each occurrence of 'foo', and replace it with 'bar'. :%s/foo/bar/gc Change each 'foo' to 'bar', but ask for confirmation first. :%s/\<foo\>/bar/gc Change only whole words exactly matching 'foo' to 'bar'; ask for confirmation. :%s/foo/bar/gci Change each 'foo' (case insensitive) to 'bar'; ask for confirmation. This may be wanted after using :set noignorecase to make searches case sensitive (the default). :%s/foo/bar/gcI Change each 'foo' (case sensitive) to 'bar'; ask for confirmation. This may be wanted after using :set ignorecase to make searches case insensitive. The g flag means global – each occurrence in the line is changed, rather than just the first.
|
转载地址:http://toqbi.baihongyu.com/