I have a tar file that contains multiple .Z files. Hence I need to issue a tar command followed by a gzip command to fully extract the files. How do I do it in a single command?
What I'm doing now is
tar xvf a.tar (this will output 1.Z and 2.Z)
gzip -d *.Z (to extract 1.Z and 2.Z)
This "almost" works. But somehow there is a .gz appended to the file name which makes it fail. How to tweak it?
# tar xvf a.tar | xargs gzip -d
x.gz: No such file or directory
RET20120101.dat.Z,.gz: No such file or directory
939194.gz: No such file or directory
bytes,.gz: No such file or directory
1835.gz: No such file or directory
media.gz: No such file or directory
blocks..gz: No such file or directory
x.gz: No such file or directory
RET20120102.dat.Z,.gz: No such file or directory
939194.gz: No such file or directory
bytes,.gz: No such file or directory
1835.gz: No such file or directory
media.gz: No such file or directory
blocks..gz: No such file or directory
# tar xvf a.tar
x RET20120101.dat.Z, 939194 bytes, 1835 media blocks.
x RET20120102.dat.Z, 939194 bytes, 1835 media blocks.
If I do below, there is no ouput.
tar xvf a.tar | grep '.Z$'
If I do below, it's almost there but the extra , after the .Z is causing problem. Any suggestion how to get it right?
# tar xvf a.tar | grep '.Z' | xargs gzip -d -S ""
x: No such file or directory
RET20120101.dat.Z,: No such file or directory
939194: No such file or directory
bytes,: No such file or directory
1835: No such file or directory
media: No such file or directory
blocks.: No such file or directory
x: No such file or directory
RET20120102.dat.Z,: No such file or directory
939194: No such file or directory
bytes,: No such file or directory
1835: No such file or directory
media: No such file or directory
blocks.: No such file or directory
I too have a doubt regarding the unzipping of the files.. I have a file named logfiles_tar.tgz under my log directory..At the end of the day all of the logs gets zipped to this particular file. If i want to unzip all the files, what am gonna do?
Please do not ask new questions in existing threads. Unless you have new information to a particular problem, please create a new thread in the appropriate forum.
Also, please search the forums first, as it might be that someone has already posted an answer for a similar problem.