Search and Replace with Vim

Using the following code if you wanted to replace ā€˜Gā€™ with ā€˜Aā€™.

CODE

  1.  
  2. if (k .LT. ground) then
  3. cay(i,j,k) = ( 1.0-sigmaG*dt / (2.0*epsG) ) / &
  4. (1.0 + sigmaG*dt/(2.0*epsG) )
  5. cby(i,j,k) = (dt/epsG) / ( 1.0+sigmaG*dt / (2.0*epsG) )
  6. endif
: 2,6 s/G/A/gc

This searches from line 2 through 6 and prompts you every time to make the changes.