LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-14-2011, 11:01 AM   #1
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Rep: Reputation: 4
Editing a compressed tar..


Hey guys, so Basically... think of this directory as the current structure..

Quote:
.
|-- test
| `-- test1
`-- test.tar
test.tar is a compressed tar of /test/ (cvfz), now... I need to add another file called test2 to test.tar, WITHIN the test directory in the tar. Is this possible?

Right now, tvf results to this..
Quote:
drwxr-xr-x ######/###### 0 2011-03-14 08:52 test/
-rw-r--r-- ######/###### 0 2011-03-14 08:52 test/test1
When this is done, I want it to look like this..


Quote:
drwxr-xr-x ######/###### 0 2011-03-14 08:52 test/
-rw-r--r-- ######/###### 0 2011-03-14 08:52 test/test1
-rw-r--r-- ######/###### 0 2011-03-14 08:52 test/test2
Anyway to do this without having to recompress the files again?..
 
Old 03-14-2011, 11:05 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
The man page for tar suggests using the -r option, e.g.

$ tar -r test/test2 -f test.tar

Edit: misread the question. This doesn't seem to work for compressed archives.

Why do you specifically need to not have to just recreate the compressed archive again with the new file(s)?

Last edited by Nylex; 03-14-2011 at 11:09 AM.
 
Old 03-14-2011, 11:13 AM   #3
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by Nylex View Post
The man page for tar suggests using the -r option, e.g.

$ tar -r test/test2 -f test.tar

Edit: misread the question. This doesn't seem to work for compressed archives.

Why do you specifically need to not have to just recreate the compressed archive again with the new file(s)?
There are 78 compressed tar's, all about 6gb in size..
 
Old 03-14-2011, 11:15 AM   #4
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Original Poster
Rep: Reputation: 4
Any way to uncompress without extracting?..
 
Old 03-14-2011, 11:17 AM   #5
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by Nylex View Post
The man page for tar suggests using the -r option, e.g.

$ tar -r test/test2 -f test.tar

Edit: misread the question. This doesn't seem to work for compressed archives.
It should work if you pass it through the same compression utility, which was given above as gzip.

$ tar -rz test/test2 -f test.tar
 
1 members found this post helpful.
Old 03-14-2011, 11:28 AM   #6
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by SL00b View Post
It should work if you pass it through the same compression utility, which was given above as gzip.

$ tar -rz test/test2 -f test.tar
Negative...

This works, but it sucks..

1) for i in `ls`; do mv $i $i.gz; done # gunzip wont work on files that dont end in .gz, or so it seems

2) gunzip * # Make them uncompressed tar files

3) tar -r test/test2 -f test.tar # add it

3) gzip * # compress

fml, thats gonna take forever

Last edited by iuselinux; 03-14-2011 at 11:30 AM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need to check tar file against directory it just compressed pendal Programming 5 12-03-2009 12:06 PM
Problem:zip: file_name.tar.gz: invalid compressed data--crc error. rajivdp Linux - Newbie 8 06-15-2009 09:31 AM
LTO compressed backup using tar in RH Linux ppanyam Red Hat 1 12-07-2007 03:14 AM
Using Tar/Star to copy a compressed file from tape geokker Linux - Software 1 09-09-2005 07:32 AM
How to uninstall program compressed with tar.gz ronronson Linux - Newbie 1 06-11-2004 03:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:07 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
Open Source Consulting | Domain Registration