vim is the much-loved text editor when it comes to the command line or the terminal, but it has a learning curve when it comes to performing normal day-to-day operations like find and replace.
Let us take a look at various ways to perform find and replace operation using the:s substitution command,
Find and Replace 1st occurrence in a Line
:/s/sample/example


Find and Replace all occurrences of in a Line
:/s/line/line1/s


Find and Replace All occurrences of in a File
:%s/Say/Hello


-
Have Questions? Post them here!
More Posts:
- macOS 13 Ventura - The New About this Mac Window - MacOS
- Get Desc of Table using Java JDBC - Java
- How to increase macOS Terminal text font size (Big Sur) - MacOS
- Add Bookmark macOS Safari - MacOS
- Set Title to Android AlertDialog - Android
- How to send WhatsApp message from your Android App using Intent - WhatsApp
- Google Chrome Update failed (error: 12) - Chrome
- How to add border to Android Button - Android