As expected, someone pointed out a simple utility to handle my command-line search and replace needs: gsar – General Search And Replace utility. It does what I need it to do quite nicely. It doesn’t allow for regular expression searches, but I don’t need that anyway. So my TextReplace utility is officially scraped. Thanks to Mike Gunderloy @ Larkware (previously RSS subscribed).
Stupid TextReplace Utility
Is there a decent (note, my standards are low) command line text file search & replace utility around? Everything I’ve found is a perl script, requires Ruby or costs money. Not that I can’t afford $25 for a usable utility, but I don’t think $3 / line of code is worth it. I built an ultra-simplistic .NET utility that was 8 lines of code (not including error handling, usage guide and license) that just takes a single file name, search regular expression and replacement text and uses the built in regular expression object to do the replacement.
I expect that someone will point out something ultra-obvious to me, and I’ll send my ultra-simplistic code to the recycle bin. If not, I’ll post the 8 lines of code (plus the error handling, usage guide and license).