Well, I now despise Windows for having such a totally sucky console, but I managed to get this working.
As an exercise for myself I compiled GNU grep myself. It required a couple of patched but all-in-all relatively simple. If you're not capable of this yourself, you can get an only slightly outdated binary from UnxUtils
(I've included my build in the attached zip). Converting the shell script to batch was a huuuge pain in the ass because (again) the Windows console sucks, and doesn't honor piping symbols in a for loop in the same way it would as a standalone command (you have to enclose your command in parens prior to the >, < or | symbol). God help you trying to find that in Google (I ended up randomly guessing it). Finally, grep on Windows converts CRLF line endings to plain LF (for internal operational reasons), so we need the todos
utility to convert them back again.
So here you are, give it a try and let me know how it goes.
Er...should this not be moved to the coding snack new request forum?
If you have cygwin, you can do this under windows as well.MSYS
will manage it also, minus the enormity of Cygwin.