This will ask you before replacing.

%s/oldword/replaceword/gc

Brad Bendily wrote:
> Now, the next couple things are the reasons I wanted to
> and currently do use vi. It's the search/replace functions.
> 
> :s/oldword/replacedword/g
> 
> that will replace every instance of oldword with repacedword
> on one line. if you add a % it will do it in the whole file:
> 
> :%s/oldword/replacedword/g
> 
> also, you can do this, add some text to the begining of every line
> in a file:
> 
> :%s/^/addtext/g
> 
> or add text to the end of every line in a file:
> 
> :%s/$/addtext/g
> 
> You can read in a file:
> :r filename
> 
> 
> The search/replace stuff is what I use most often, while creating
> scripts or editing files.
> 
> Does anyone else have some cool feature of vi that they use that
> they would like to add to the cool feature list??
> 
> 
> BB
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://brlug.net/mailman/listinfo/general_brlug.net

Reply via email to