LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-12-2006, 04:36 AM   #1
majalee
Member
 
Registered: Jul 2004
Location: India
Distribution: Ubuntu / OpenSuse
Posts: 54

Rep: Reputation: 15
how to delete a particular file from tar file


i have a tar file from which i would like to delete a particular file. can i do it without untar it, deleting the file and tar back ?

just tried out --delete option, but the tar file just doesn't seem to be doing anything.

aaditya
 
Old 07-12-2006, 05:06 AM   #2
zeitounator
Member
 
Registered: Aug 2003
Location: Montpellier, France, Europe, World, Solar System
Distribution: Debian Sarge, Fedora core 5 (i386 and x86_64)
Posts: 262

Rep: Reputation: 30
Code:
tar --delete -f yourArchive.tar archivePath/to/file
It seems you cannot use this on a compressed archive, your must decompress it first and then recompress it.
Code:
[clavel@home ~]$ tar zcf test.tar.gz test
[clavel@home ~]$ tar ztf test.tar.gz
test/
test/blo
test/bla
[clavel@home ~]$ tar -z --delete -f test.tar.gz test/blo
tar: Cannot update compressed archives
Try `tar --help' or `tar --usage' for more information.
[clavel@home ~]$ gunzip test.tar.gz
[clavel@home ~]$ tar --delete -f test.tar test/blo
[clavel@home ~]$ gzip test.tar
[clavel@home ~]$ tar ztf test.tar.gz
test/
test/bla
 
Old 07-12-2006, 05:53 AM   #3
majalee
Member
 
Registered: Jul 2004
Location: India
Distribution: Ubuntu / OpenSuse
Posts: 54

Original Poster
Rep: Reputation: 15
thanks zeitounator !!

yes !! as you said, one cannot delete single files from compressed archives.

thanks once again.
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
'Read-only file system' when untar a tar.bz2 file yinglcs Linux - General 1 02-18-2006 10:12 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
tar -cvzf file.xml file.tar.gz RickHunter_Ve Linux - Software 1 10-06-2004 01:58 PM
Large tar file taking huge disk space in ext3 file system pcwulf Linux - General 2 10-20-2003 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:55 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