0

I am looking for an AIX command to extract a particular text file from a compressed file.

For example, my compressed file abc.gz contains millions of files with multiple sub directories. I need to extract a single file using the wildcard. could someone please help.

  • Compressed File: abc.gz
  • Need to extract files like: %defg%
  • 3
    How does it contain millions of files? Is it a tar ball? is it a zip file? Unless you know (and tell us) the structure of what abc.gz contains, the only thing you can do is uncompress it with gzip and look through it with a text editor. – NickD Jan 14 at 14:19
  • 1
    Possibly also .cpio.gz. The key fact is that .gz files contain a cumulative (and implicit) decoding table, which can only be reconstructed by decompressing the whole file. There is no way to decompress any arbitrary part of the file, even if you can find where it starts. – Paul_Pedant Jan 14 at 17:35
1

There is a difference between compression of files and archiving of files.

Compression is the reduction of volume of a file.

Archiving is storing of one of multiple files in an archive file with or without compression.

A file with extention '.gz' is a compressed file. So your task sounds incorrect.

But in *nix environments we often use compression of a tar archive, usually such a file has '.tar.gz' or '.tgz' extention. Also there can be a different type of archive compressed (or different extention used).

So I guess you ask how to extract a file from a compressed archive. But to answer your question, some more details about a type of your archive required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.