help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to apply a list of regex replaces to multiple files?


From: Tim X
Subject: Re: How to apply a list of regex replaces to multiple files?
Date: Wed, 02 Jul 2008 18:20:16 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"michael.l" <michael.lommel@gmail.com> writes:

> On Jul 1, 1:38 am, "Lennart Borgman (gmail)"
> <lennart.borg...@gmail.com> wrote:
>> michael.l wrote:
>> > I've browsed the messages here and have googled but don't see a clear
>> > solution yet. I have about 900 documents to which I need to apply a
>> > list of maybe 40 separate regex search and replaces. I would like to
>> > feed a list of the regex expressions and replacements to emacs and
>> > have it applied to a directory of the files. Any solutions? Keyboard
>> > macros don't seem like the right solution....
>>
>> Sounds like the best would be writing a small elisp function to do the job.
>
> I'll look into elisp...Struggled with perl to do this....

Well, not meaning to sound rude, but if you had trouble doing this with
perl, I suspect you will have even a harder time with elisp. I only say
this as, from your description, perl would be my first choice and it
should be pretty straight forward. I personally find perl regexp a lot
easier to work with and a lot more powerful than elisp's
implementation. After perl, my second choice would
likely be sed (actually, sed may be my first choice if you have quite a
number of regexp because you could put them all in a file and then just
run sed on the files - essentially, no programming. However, sed can be
a little tricky to wrap your head around as it has a hell of a lot of
power.


Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

[Prev in Thread] Current Thread [Next in Thread]