in reply to "ack" and replace in a directory... in Windows?

Substitute the ack command for the dir command the following:

for /f %i in ('dir /b *.pl') do @perl -i*.bak -pe"s/foo/bar/g" %i

Note the requirement for specifying the extension with the -i switch.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: "ack" and replace in a directory... in Windows?
by mascip (Pilgrim) on Feb 29, 2012 at 12:17 UTC

    It works perfectly on my computer, thank you!

      You already have perl good fellow, don't do the batch file twist, it'll hurt your brain (did mine)

        Re-reading this a bit later, thank you. It is indeed very useful to have one language to do everything.