global search and replace
Erik Price
eprice at ptc.com
Tue May 13 10:05:50 EDT 2003
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
> HomeSite.
Does jEdit offer what you are looking for? It is the only editor I am
familiar with other than BBEdit (which does offer what you are looking
for and more, but is a Mac-only text editor). jEdit offers PCRE
regex-based search/replace and does let you run the commands across all
files in a specified directory.
> It has been so long since I used perl, that I have to dig through my
> books and old code snippets even to find and understand the recipes that
> I come across.
>
> How do you do this?
With Perl.
I'm not trying to be a smart-aleck, but the fact that you can combine
powerful regex-based search/replace with conditional processing makes
Perl a far better choice (for me) than to do multiple passes of
search/replace with a text editor. I don't use Perl for writing
"software" (even though there are plenty who do), but I do use Perl for
writing "scripts". Its flexibility for this purpose is unrivaled, IMHO.
Good luck,
Erik
More information about the gnhlug-discuss
mailing list