Juan Garcés

Personal Blog

Replace With VIM

August 17th, 2014

Esta entrada también está disponible en: Spanish

Many times I have seen the need to replace text with VIM. Here I leave the way to do.

First, we open the file to edit:


vim file

We press ESC and insert colon “:”. After that, we insert the instruction:


:1,$ s/search_text/replacement_text/g

The characters 1,$ indicate that should search from the first to the last line of the file. After, just replace “search_text” and “replacement_text” for that we need.

Juan Garcés

Personal Blog