How to use Vim for string Search & Replace?
Assuming here is a file "Peter.txt". How could we do search & replace using Vim?
1. INPUT vim Peter.txt
2. PRESS Ctrl+C key
3. INPUT :1,$s/blue/purple/g
4. PRESS Enter key
Now, we could successfully replace all the strings "blue" to "purple" in file "Peter.txt"
Note: "1,$" means from the first line to the end of file.
1. INPUT vim Peter.txt
2. PRESS Ctrl+C key
3. INPUT :1,$s/blue/purple/g
4. PRESS Enter key
Now, we could successfully replace all the strings "blue" to "purple" in file "Peter.txt"
Note: "1,$" means from the first line to the end of file.
留言
張貼留言
Welcome to share your comments or questions : -)
Enjoy life!