There are a couple of ways this could be easily applied:
The first one is pretty doable (the sort of hackable grep script that you don\'t want to write, but
grep