VI find and replace
Introduction: This tutorial is meant for VI text editor, mainly for linux, generally used in Console [my black Screen]
Tutorial Reference:
Linux.ie
Search (Wraped around at end of file):
Search STRING forward : / STRING.
Search STRING backward: ? STRING.
Repeat search: n
Repeat search in opposite direction: N (SHIFT-n)
Find and Replace
First occurrence on current line: :s/OLD/NEW
Globally (all) on current line: :s/OLD/NEW/g
How did this happen?
Actually IPs changed from 203.91.136.234 to 116.90.239.10.
I had access to only vi editor and then, I need to replace the former with the latter. Later I found this :
:s/203.91.136.234/116.90.239.10/g
This just replaced 203.91.136.234 to 116.90.239.10 and the operator g was meant for global, same as in Perl.
Doing this, that is invoking the command in vi command prompt solved all my problem. But every time I had to press " n " for finding 203.91.136.234. Then invoking :s/203.91.136.234/116.90.239.10/g this solved them.
0 Comments:
Post a Comment
<< Home