Global search & replace in Vim

Cory Spitz spitzcor@cray.com
Thu, 14 Jun 2001 13:42:17 -0500


Oops agian.  I'm just not with it today.  I meant thanks to Mark
Szidik!

-Cory

On Thu, 14 Jun 2001, Cory Spitz wrote:

> Oops, the below will only change one instance per line (in vi).
> dpk's solution works much better.
> Thanks dpk.
> -Cory
>
> On Thu, 14 Jun 2001, Cory Spitz wrote:
>
> > :g/string1/s//string2
> >
> > should work.
> >
> > On Thu, 14 Jun 2001, Reza Beha wrote:
> >
> > >
> > > Greetings, friends.
> > >
> > >    I've been fruitlessly seeking a method for replacing every instance of a string in Vim, without needing to know a file length or row range.  The best I've come up with so far is:
> > >
> > > :s/string1/string2/g xxx
> > >
> > >   Where 'xxx' is the length of the file (like 317 lines, for instance).  What is the proper way to accomplish this?  Thanks in advance.
> > >
> > > Migrating from VMS to Linux,
> > >
> > >                Reza
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------
> > > Do You Yahoo!?
> > > Yahoo! Buzz Index - Spot the hottest trends in music, movies,and more.
> >
> >
>
>