Operating System - HP-UX
1833012 Members
2971 Online
110048 Solutions
New Discussion

Re: Removal of file from tar file

 
Amrit_1
Advisor

Removal of file from tar file

I would like to know the command wherein I can removal a file from the tar file. For eg.

In case there is a file a in tar abc.tar. After the removal activity. the tar file abc.tar should not have the file a.
9 REPLIES 9
Sunil Sharma_1
Honored Contributor

Re: Removal of file from tar file

I don't think such command is available.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
KapilRaj
Honored Contributor

Re: Removal of file from tar file

1. Extract the tar in to a sub directory
2. Remove the file a
3. Do a tar

Ha ha ha ...

Kaps
Nothing is impossible
Robert-Jan Goossens
Honored Contributor

Re: Removal of file from tar file

Hi,

Nope I don't think you can do that, you could use the w option to confirm the action.

Regards,
Robert-Jan
Amrit_1
Advisor

Re: Removal of file from tar file

Should the syntax be : tar xw abc.tar a
Amrit_1
Advisor

Re: Removal of file from tar file

HI Guys,

Awaiting your inputs. Have a critical issue and your inputs would be really valuable.

Thanks in advance,
Amrit
KapilRaj
Honored Contributor

Re: Removal of file from tar file

Amrit,

There is no option though you can do some thing like reading the tape and then writing it to a diffrent tape excluding the file u want to remove.

I think the reason 'why not' is that, the tar format does not have a FileAllocation table or something like that like a Filesystem.

Regds,

Kaps
Nothing is impossible
Sanjay Kumar Suri
Honored Contributor

Re: Removal of file from tar file

Follow Kapil's solution.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Nicolas Dumeige
Esteemed Contributor

Re: Removal of file from tar file

Hello,

GNU tar can do it with the --delete option.

Cheers

Nicolas
All different, all Unix
Nicolas Dumeige
Esteemed Contributor

Re: Removal of file from tar file

Furthermore, it has the gzip option and other intersting capabilities.
All different, all Unix