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.

留言

The Hottest Articles

OWASP Security Shepherd Project - My Practice & Solutions

OSCP回顧 & 準備建議

OWASP Security Shepherd Project - SQL Injection 3 (Injection Challenge)