A quick update to my older blog about using Perl to do a very very fast find & replace on files.
for /R c:path %i in (*.htm *.gif) do @c:perlperl.exe -p -i.bak -e "s/old/new/g" %i
Note that the above is for running from Windows command line only, assuming c:perlperl.exe is your Perl intepreter (e.g. ActivePerl). It will recursively update all *.htm and *.gif files starting in c:path, replacing “old” with “new”. I do @perl.exe so that the command prompt doesn’t print out a line for every file that it finds.
Also, if you’re going to put these in a BAT file, you need to double up the % signs for the variables. This version you can put in a BAT file
for /R c:path %%i in (*.htm *.gif) do @c:perlperl.exe -p -i.bak -e "s/old/new/g" %%i