Find and replace on vim. for those who use vim, there is a feature on vim that you can use to do “find and replace”. This feature is a standard feature that every text editor should have, including vim.
For example, many files that are edited using default windows text-editor on windows machine will have “^M”. This annoying end-of-line character will give an error when the script run under Linux. Therefore, you need to edit the file and do find and replace on that file, and vim can do that for you.
to do find and replace, you need to be on the “command mode” (press esc) and to the syntax below:
tadaaa… you have done a find and replace.
to undo, just press u
Using vim is really different if you compare it when you use a recent text editor or even a word processor. vim was designed many years ,ago where the graphical user interface and mouse pointer were not invented yet. Therefore vim is fully utilizing command-line interface without necessarily using your mouse.
if you are new to vim, the learning curve might be steep because there are many shortcuts to do many things. also the escape button will be pressed a lot as you want to switch to different mode on vim. however, once you are familiar with it, vim can really do the job faster.
This topic is part of System Administration course at GLC Networks. for more information, please contact here.
picture from thegeekstuff.com