Linux/Searching compressed archives

Find out which file within an archive contains a text string:

7z e -so example.7z   2>/dev/stdout  |grep -i -a -P "(Extracting|search term)"

The redirection of  to   using   is necessary since   prints file names to   (prepended by the word "Extracting", hence  ), but it needs to be in   to be picked up by   through the pipe. Optionally, append  (read: Wikipedia: less (Unix)).

is used since it apparently supports the widest range of archive formats, more than ,  , and.

If anyone has a better solution, feel free to add it.

If the archive is a TAR wrapped within a format such as GZip, BZip2, or XZip, the following command can be used:

7z e -so example.tar.xz  |7z e -si -so -ttar  2>/dev/stdout | [piped commands here]