LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2011, 03:41 AM   #1
adarshmca
LQ Newbie
 
Registered: Dec 2010
Posts: 28

Rep: Reputation: 0
Tar 2 .gz files into 1


Dear all, I have 2 tar.gz files which i want to untar into 1 file( ApacheUIMA ).

Fore.g I have UIMA12.tar.gz and m1.tar.gz .
I also know the commands as I have done it before :

gzip -dc UIMA12.tar.gz | tar xvpf -
gzip -dc m1.tar.gz | tar xvpf -

It untars into one folder ApacheUIMA but today it untars into 2 separate folders.

I know these commands as I done by

gzip -dc ge-6.2u5-common.tar.gz | tar xvpf -
gzip -dc ge-6.2u5-bin-lx24-amd64.tar.gz | tar xvpf -

into 1 folder sge-root.


Can someone Please tell me the how these commands work and what to do to untar in one folder.


Thanks and Regards

Adarsh Sharma
 
Old 01-05-2011, 04:29 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Hi. First, you don't really need gzip, since GNU tar can manage compression on the fly. You need it only for some older Unix flavours. Moreover you can omit the -z (for gzipped files) option since tar determines the kind of compression automatically:
Code:
$ tar zxvf UIMA12.tar.gz
$ tar zxvf m1.tar.gz
However there is not an explanation for your issue, except for the fact that the two archives actually contain a different directory structure. What is the output of the following commands (with t in place of x)?
Code:
$ tar ztvf UIMA12.tar.gz
$ tar ztvf m1.tar.gz
Please post only the first lines of the output if it is long and please use code tags to improve readability. Thanks.
 
Old 01-05-2011, 04:35 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,496

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
I am not sure if this is what you are after, but maybe it will help:
Code:
tar axf UIMA12.tar.gz -C ApacheUIMA/
tar axf m1.tar.gz -C ApacheUIMA/
 
Old 01-05-2011, 11:36 PM   #4
adarshmca
LQ Newbie
 
Registered: Dec 2010
Posts: 28

Original Poster
Rep: Reputation: 0
Following is the output of commands :


[root@ws-test opt]# tar ztvf UIMA12.tar.gz
drwxrwxrwx root/root 0 2011-01-05 11:52:25 UIMA12/
drwxr-xr-x root/root 0 2011-01-05 11:52:25 UIMA12/metadata/
drwxr-xr-x root/root 0 2011-01-05 11:52:16 UIMA12/data/
drwxr-xr-x root/root 0 2011-01-05 11:52:17 UIMA12/resources/

and so on......................


[root@ws-test opt]# tar ztvf m.tar.gz
-rw-r--r-- 0/0 3889 2009-07-02 18:59:06 apache-uima/examples/.classpath
-rw-r--r-- 0/0 20905 2009-12-08 00:10:47 apache-uima/README-uima-as
-rw-r--r-- 0/0 292143 2010-01-08 03:13:44 apache-uima/lib/uimaj-as-core.jar
-rw-r--r-- 0/0 140517 2010-01-08 03:14:04 apache-uima/lib/uimaj-as-activemq.jar
-rw-r--r-- 0/0 66097 2010-01-08 03:13:47 apache-uima/lib/uimaj-as-jms.jar

and so on ................



And second command result as , I think there is some problem :

[root@ws-test opt]# tar axf UIMA12.tar.gz -C ApacheUIMA/
tar: invalid option -- a
Try `tar --help' or `tar --usage' for more information.
[root@ws-test opt]#


Best regards

Adarsh Sharma
 
Old 01-06-2011, 02:12 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,496

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
Seems we might have differing versions of tar. Simply replace the 'a' with a 'z'
Code:
tar zxf UIMA12.tar.gz -C ApacheUIMA/
 
Old 01-06-2011, 03:39 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
@adarshmca, given your example commands in post #1 I assume the original archives should have the same directory structure inside them, or better they should have both the first level directory equal to ApacheUIMA. From the output of the suggested commands, I see the structure is different and they are extracted in different directories. Hmmm... that's not so simple, is it?! Please, try to better explain your issue.

@grail, I think you're the only and unique *nix user in the world that uses the -a option of tar!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
More tar issues - listing files in a single tar from a multivolume borks Thymox Linux - Software 4 09-23-2009 07:48 PM
how to untar files with tar.tar extension johnkalikavunkal Linux - General 5 07-11-2008 05:36 AM
tar -zxvf foo.tar.gz creates all .gz files prophoto Linux - General 11 11-09-2006 06:27 PM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 08:09 PM


All times are GMT -5. The time now is 09:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration