Instead of building reusable tools this could probably be solved with some simple scripts that use the filenames to generate grep patterns.