It depends exactly what you want to do.
If you just want to test for the presence of a pattern, you can use zgrep. If the pattern exists in any of the files which are in the tar file it should see it. However, you won't get any idea about which file in the archive the pattern was found in. It will also find the pattern if it is part of tar's archive structure, which might not be what you want.
If you need more information, or to avoid possible false positives with matches in the tar structure, you need to extract the archive to some temporary area and then grep it.
A quick google reveals a Perl module for handling tar files. If your file fits easily in memory you might have joy writing a simple program to do that rather than extract it.
|