Search This Blog

Wednesday, July 4, 2007

Replacing characters using vi editor

To replace character "old" by "new" in a file "myfile.txt",

1) Open the file using vi editor:
vi myfile.txt

2) Use keystrokes of Esc, followed by
:1,$s/old/new/
or
:%s/old/new/

which will replace all "old" with "new" within the entire document.

1 comment:

Albert S. Kim said...
This comment has been removed by the author.

Labels

Bacteria

Loading...