File Based Search/ReplaceWhen you want to do a search-replace for all text files in a folder, first select the folder in the Mac Finder, then run this script.
It prompts you for a search string and a replace string.
All text files in the folder are searched. Any file that contains the search string is processed and then rewritten.
The names of all the files that contain the search string appear in the Main Window.
This script is Mac-specific. When we nail down the cross-platform way of working with file paths it should be updated.
Why I wrote it
I needed to fix a bunch of non-relative URLs in a large website.
You can link this script into the Finder's menu bar by editing system.menubars.MACS.
See Your First Script for a tutorial on doing that.
For more utilities that run from the Mac Finder's menu bar, see The Finder and Frontier.
If you don't have Frontier, here's a listing of the source code for the file search replace script.