I'm looking for an application with the ability to search matching strings (as designated as anything between a set "prefix" and "suffix") and display them (or what would even be BETTER is if it could write them to a text file).

I've looked into text wrangler and it doesn't fit my needs because it can only do it on a file-by-file basis: I am looking for an app that you can point it to a directory and it does this process for all text files in this directory.

Additionally, if it could do two strings as a time (and group them according to the text file, so I could differentiate), that would be even better.

Does anyone know of an app that can do this? If not, is it possible this process be coded (javascript, php, etc)?