Search and replace in linux vi editor


This command will replace all the occurences for oldstring with newstring after confirming for each existence (c in the end tells vim to ask for confirmation).

More on search replace –

Some other useful commands are

/ for search 
n find next while search (after /)
N find previous while searcg (after /)

:$ last line of file
:0 first line of file