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


Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!