比如我寫了如下的一個信件
% vi letter
------------------------------------------------------------------
Hi tom,
I think I failed my anatomy test yesterday. I had a terrible
stomach ache. I ate too many fried green tomatoes.
Anyway, Tom, I need your help. I'd like to make the test up
tomorrow, but don't know where to begin studying. Do you
think you could help me? After work, about 7 PM, come to
my place and I'll treat you to pizza in return for your help. Thanks.
Your pal,
guy@phantom
我覺得tom可能出去旅游了不會收到這個郵件,我還是寄給別人那麼我可以這麼做
% vi letter
------------------------------------------------------------------
Hi David,
I think I failed my anaDavidy test yeserday. I had a terrible
sDavidachache. I think I ate too many fried green Davidatoes.
Anyway, Tom, I need your help. I'd like to make the test up
Davidorrow, but don't know where to begin studying. Do you
think you could help me? After work, about 7 PM, come to
my place and I'll treat you to pizza in return for your help. Thanks.
Your pal,
guy@phanDavid
~
~
~
:1,$s/tom/David/g
其中 1,$表示從第一行到文本結束,/tom/David/g是正規表達式,表示將tom替換為David 那麼這個命令就是全文搜索tom並將其修改為David