1

Can somebody help me to figure out a command to find a file recursively that is embedded in a tgz file which is within another tgz files recursively:

MainFile.tgzSubFile1.tgzSubFile2.tgzSubFile3.tgzabc.txt

My goal is to be able to list abc.txt without extracting MainFile.tgz nor SubFileX.tgz.

The command below is only listing the first level of files (i.e. SubFile.tgz); therefore the grep command cannot find abc.txt in the list:

tar tvf MainFile.tgz | grep abc
Carlos
  • 11

1 Answers1

2

You need to extract them, but you don't need to store them on the disk :

tar -xOf MainFile.tgz SubFile1.tgz | tar -xO SubFile2.tgz | tar -xO SubFile3.tgz | tar -x abc.txt

The -O flags sets output to stdout and without -f tar will accept archive data from stdin.

Aaron
  • 281