global search and replace

Greg Rundlett greg.rundlett at buzgate.org
Tue May 13 10:53:33 EDT 2003


One PERL snippet I could use is

perl -i -pe 's/red rose/blue ball/g' *.php

because it gets the job done quickly and I understand it.

Scripts like Paul's are more elegant, but I haven't used perl for about
two years, so I am really rusty at the intricate details.  This little
episode has made me resolve to dust off my Perl books and code archives
so that I _can_ setup a useful box of recipes.

But what I really want is to have this integrated into my editor.  I
just started to use Quanta Plus because it has some really nice features
for coding XHMTL, PHP, CSS, JavaScript etc. and even does an extended
search.....it just doesn't come with the 'REPLACE' part yet.

I've looked at a lot of editors over the years, and actually started
using phpEdit on Windows a while ago because it is really good for
writing object-oriented PHP classes that are fully commented in
phpDocumentor format - but it is only capable of doing exactly what
Quanta Plus does for searching and replacing across multiple
directories.  (it can grep, it can't replace)

I have always had a copy of HomeSite lying around, so I've been able to
use that when needed, plus I generally don't include repetitive text in
multiple files anymore (I use includes for common elements)...but
occasionally I still need to do this kind of thing.  Now that I've
completely moved to Linux, I'm baffled as to how other Linux coders do
this kind of thing.  I'll admit that I just want to get things done
easily, because I have a mountain of real work to do...and don't have
time to spare.

I might just check out jEdit.  I didn't want to use Komodo (ActiveState)
or phpEd (Nusphere), or Zend Studio (Zend) because I want something free
that I can take with me anywhere, use forever, share with others, and
contribute to if I ever get smart enough ;-).

- Greg

On Tue, 2003-05-13 at 10:01, brian wrote:
> vim supports most standard perl-esque regexp/search and replace type
> functions.  You can do global search/replace in vi/vim with something
> like:
> :X,Ys/this/that/
> 
> Search through lines X through Y, replace first this with that
> 
> :1,.s/this/that/g
> 
> Search from line 1 through current line (specified by '.') replace all
> this's with that's.
> 
> etc...
> 
> On Tue, 2003-05-13 at 09:41, Greg Rundlett wrote:
> > I spent the day yesterday upgrading my Quanta Plus install (hoping the
> > feature was available in the newest version), and looking online for
> > various ways to do a simple text replacement across thousands of files. 
> > I know that there are perl scripts that with the proper care will do
> > what I want, but why isn't this feature built-in to VIM, Quanta, or
> > other editors?  AFAIK, the only editor that does this on Windows is
> 
> 
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
> 




More information about the gnhlug-discuss mailing list