People have mentioned that it's best for a utility "to do one thing well". It seems to me that even the existing grep options do three things (in the complex use cases):
- select a set of files - uncompress the files (if they're compressed) - search within the file contents I am ignoring the case of extracting members from archive files. It seems to me that if one wanted to do a version of this that isn't covered by the existing grep options, step 1 can best be done by "find". Step 3 can be done by running grep on each set of contents, with --label=name to get output lines labeled with the original file name. What doesn't seem to exist is something that does step 2 in a general way. The tool that is needed is something that reads the first few bytes of a file, determines which compression signature is present if any, then processes the contents through the correct decompressor. Ideally, it would be programmable in something like the manner of "file" so that additional compression formats could be fitted into the framework, and it could use either a compiled-in decompression library (like zlib) or call an external decompression program, as necessary. Actually, I'm asking whether anybody knows whether such a tool exists already. It seems like a "natural" facility that somebody would have thought to write maybe fifteen years ago. Dale