Date: Sun, 1 Aug 1999 11:39:59 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Dave Scott cc: djgpp AT delorie DOT com Subject: Re: Global file edit? In-Reply-To: <19990723.1942.13701snz@roborat.demon.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Fri, 23 Jul 1999, Dave Scott wrote: > Is there a simple utility available to do something like this :- > > edit Write a batch file that does this for a single file (by redirecting Sed's output and then mv'ing the result into the original file), then use `find' to invoke the batch file on every file in turn. Don't forget to use -dosexec instead of -exec, and don't forget to invoke the batch file through "command.com /c". Something like this: find -name '*.c' -o -name '*.cpp' -dosexec command.com /c foo.bat {} ; Where foo.bat is something like this: @echo off sed -e s/[^x]malloc/xmalloc/g %1 > tmp mv -f tmp %1 Actually, for this to work, you need to give a full pathname of foo.bat on the `find' command line, or put it somewhere on your PATH, because otherwise when (and if) it descents into subdirectories, it will not find foo.bat anymore. Note that I didn't test all this, so I might be missing something.