In needing a tool to convert files between utf8 and ascii with above-ascii code points escaped \xXX or \uXXXX, I just ended up refactoring rsif a bit. We now have a shiny process_files.pike in Tools.Standalone which you can inherit, providing a process callback of your own. This is what rsif looks like now:
#! /usr/bin/env pike
inherit Tools.Standalone.process_files; string version = ("$Revision: 1.5 $"/" ")[1]; string description = "Replaces strings in files."; string usage = #"[options] <from> <to> <files>
rsif ("replace string in file") replaces all occurrences of the string <from> with the string <to> in listed files. The name of the files that were changed are written to stdout. Directories may be given instead of files, in which case all the files in that directory will be processed. Available options: " + default_flag_docs;
int want_args = 2;
string process( string input, string from, string to ) { if( has_value( input, from ) ) return replace( input, from, to ); }
Complete documentation is available in refdoc comments in the file;
http://pike.ida.liu.se/development/cvs/view.xml?module=Pike&file=7.6/lib...
As this makes writing rsif style hacks a mere pike expression or two, a logical next step would be some lazy person bringing this power kit right up to the pike command line, for instant ad-hoc directory tree processing goodness à la pike -e 'something'.
That could make rsif the equivalent of "pike -p2 'replace(arg1,arg2)'" or similar. My own side dish hack quota just ran out for the day, but feel very free to pick up the ball! (Checked in to Pike 7.6 and 7.7.)