In article <8763ron1dr.fsf@lion.rapttech.com.au>, Tim X wrote: >"michael.l" writes: > >> On Jul 1, 1:38 am, "Lennart Borgman (gmail)" >> 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 What I used to do is use "ex" (part of vi) or maybe it was "ed". Anyway, it had a "source" stmt, ie "source myRegexAndSubstituteCmds.ex", plus a sh-script ex foo.bar source ex foo2.bar source etc something like that. Anyway, it worked, for changing variable-names in about 100 program files, totally hands-off. Back then perl likely didn't even exist. David