The Find And Replace Text utility is a handy little command-line tool to have if you’re a Windows user. It can function as a simple grep-like utility for quickly searching through whole directories of files, and you can also use it to perform mass search and replace operations on a file or group of files.

The command format is fart <options> filename search <replace>. Basic options are -r (recursive), -c (print filename and match count), -i (ignore case), -n (print matched line numbers), –c-style (interpret backslashes as c-style characters).

For example, let’s say a Linux buddy of yours sent you a bunch of html files and they have unix line endings that are barfing in notepad. One simple command fixes the problem, replacing all the newlines with a full PC carriage return, line feed combo:

fart --c-style *.html

Or perhaps you need to quickly track down some work that is left to be done throughout a big project directory. You can use fart to recursively search a directory and spit out all the file names and line numbers containing the text “TODO”:

fart -nr * TODO

It’s easy to see how you could shoot yourself in the foot with this one. Make sure to fart with caution and back up your files before doing a big search and replace.

FART @ SourceForge – Link