How to perform Find and Replace using vim Editor

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

Find and Replace first occurance
After replace

Find and Replace all occurrences of in a Line

Before find and replace line all using vim
after-replace all in line using vim

Find and Replace All occurrences of in a File

Before VIM find and Replace all in file
After VIM find and Replace all in file

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap