Gzip multiple

I have several files on AIX .gzip I need to leave them all in 1 single file as I can do

example

expla_1.gz
expla_2.gz
expla_3.gz

expected result

Final_4.gz #should contain 1, 2, 3

would looking into man tar be helpful?

1 Like

I need it with gzip

Have you tried something yourself or perhaps searched the forum for similar topics ?

Are those files present in the directory already compressed or you want to create single compressed archive ?
Looks like they are compressed upfront, but can you confirm.

Regards
Peasant.

a1379q:/Odbms/sdi/utldir/final->man gzip
Manual entry for gzip not found or not installed.
a1379q:/Odbms/sdi/utldir/final->

--- Post updated at 11:47 AM ---

I need to compress 10 files in 1 alone.

You need the literally impossible. gzip does not work that way.

You will have to compromise and use something else. Is tar available on your system?

As you didn't mention the OS you're under, this is the man gzip of RedHat.

and how would it be used?

to start with...
tar cvf bulkArchive.tar expla*.gz

1 Like

I can not find a solution to this problem

Why is the suggestion posted by vgersh99 in post #9 in this thread not a solution to this problem?

1 Like

There isn't one because gzip does not work that way.

We are not being obtuse or blocking you -- gzip doesn't work that way. gzip holds one and only one filename.

This may be counterintuitive but is completely normal for UNIX, where archiver and compressor are different programs. The usual way to pack multiple files into a gzip is to create a tar file, then gzip the tar file. This is the normal UNIX way to create an archive. tar is a standard UNIX command and file format which you now have instructions for using.

Why are you so deadset on using gzip by itself? What are your requirements?

1 Like

I am not convinced, I am ignorant in this problem so I ask for your help, as requested I am asked to use the gzip, I thought it could.

I am sorry that you don't believe us.

Have you looked at the man page for gzip ? Does the man page for the version of gzip you are using say anything about it being able to zip multiple files into a single archive (other than by zipping an archive containing multiple files?

You are, of course, free to build your own utility similar to gzip that might be able to do what you want, but the resulting archive would not be able to be unzipped by any existing gunzip utilities to restore your original files in one step.

The file format used by gzip when creating a file with the .gz suffix contains information describing the data needed to decompress the data in that file. It does not contain a table of contents needed to enable it to contain multiple compressed files.

Creating additional threads is not going to solve your problem!

1 Like

you know friend on the basis of these topics, I entered into reason to the person who asks me, and I will use .tar to achieve such a solution

Use tar I could get to what I need right ???

--- Post updated at 02:49 PM ---

they are as follows:

tar -cvf  filename_end.tar test1.csv test2.csv test3.csv test4.csv

thank you all for your support it served me very much hopefully not caused any problems

With over a 100 posts in this forum, you know that we can't answer that without knowing what operating system you're using and you clearly describing what you are trying to do. If your goal is to create a single file in the format produced by gzip , that contains more than one file and can be extracted into multiple files by a single gunzip invocation, then I don't think any currently existing software can do what you want.

If you're willing to accept an archive file containing your original files, cpio , pax , or tar can create such an archive for you and some versions of those utilities on many systems have options that will zip that archive into the same zipped file format that gzip creates. Otherwise, you can use gzip to zip the archive after it is created. On systems where cpio , pax , and tar have options to zip an archive, they also have an option to unzip an archive when reading it (or they can autodetect that an input archive has been zipped and can process it without needing an option).

On many systems, the tar command vgersh99 suggested will create an archive of your source files and then zip the archive for you.

Of course, if your system administrator had installed the manual pages on your system, you would be able to look at them and know what options are available on the utilities on your system. The manual pages available on this forum probably include a set of manual pages for a system similar to the one you have and they might give you the information you need. But each version of each operating system comes with its own set of manual pages and details on how some utilities behave often varies with each operating system update (so the man pages on unix.com are a good starting point but are not definitive for the operating system you are using).

Whether or not tar accepts:

tar -cvf filename_end.tar test1.csv test2.csv test3.csv test4.csv

or:

tar cvf filename_end.tar test1.csv test2.csv test3.csv test4.csv

or both is one of the things that varies widely between systems (and you still haven't told us what operating system you're using)!

1 Like