Restoring a single file from a group of files using tar


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Restoring a single file from a group of files using tar
# 1  
Old 03-11-2010
Restoring a single file from a group of files using tar

Hello
I take a backup using the following command on Solaris 9

tar cvf /dev/rmt/0n data

the data volume contains a number of files say a, b, c , d ... etc

Now I want to restore only one file (eg b) from the data volume.
When I issue the command
tar xvf /dev/rmt/0n data/b
I don't get the file restored.
How can I do that please?
# 2  
Old 03-11-2010
First look for your file if it exist:

Code:
tar --list -f archive.tar | grep foobar.txt

then extract:

Code:
tar -x -f archive.tar my/path/to/foobar.txt

if you have a catalogue with the name "On data" you might need to put "" around your whole file name so tar recognizes the file name.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Sql ORA-00937: not a single-group group function

I'm trying to return only one row with the highest value for PCT_MAX_USED. Any suggestions? When I add this code, I get the ORA-00937 error. trunc(max(decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100))) pct_max_used This is the original and returns all rows. select (select... (3 Replies)
Discussion started by: progkcp
3 Replies

2. UNIX for Dummies Questions & Answers

How to Tar group of Files on Sun OS

How to Tar group of Files on Sun OS? (2 Replies)
Discussion started by: Siva Sankar
2 Replies

3. UNIX for Advanced & Expert Users

tar and untar the files using single line

Hi, i want tar the files from one location and untar it to other location using single line. Can any one help me zip and unzip using single line command. (2 Replies)
Discussion started by: venikathir
2 Replies

4. Solaris

Find files older than x days and create a consolidated single tar file.

Hello, I need help in finding files older than x days and creating a single consolidated tar file combining them. Can anyone please provide me a script? Thanks, Dawn (3 Replies)
Discussion started by: Dawn Bosch
3 Replies

5. UNIX for Dummies Questions & Answers

tar command help -- extract single file

Hi, I want to view/display the contents of one file in tar file. For example if the tar file is sam.tar.gz and one of the file inside is E1.txt, how do i view the contents of this E1.txt file. Olso if I want to extract the E1.txt file only from sam.tar.gz how can i do that. Thanks in... (7 Replies)
Discussion started by: icefish
7 Replies

6. Shell Programming and Scripting

tar: extract single file to different filepath

Hi, This is my first post here - I'm hoping I can get some help! I have searched these forums and othersand not getting anything that works. I am trying to extract a single file from a tar archive to a diffierent location than it will default to. For example my tar log shows me ... a... (3 Replies)
Discussion started by: littleIdiot
3 Replies

7. UNIX for Advanced & Expert Users

restoring backup using tar command

Please help me in resolving the issue. I have taken backup using the below command $ tar cvf - . |compress -> /opt/globusback2/needed_backups/apglsg.tar.Z I tried to restore the backup using the below command. $ zcat /opt/globusback2/needed_backups/apglsg.tar.Z | tar -xvf - ... (5 Replies)
Discussion started by: amirthraj_12
5 Replies

8. UNIX for Dummies Questions & Answers

restoring backup using tar command

Please help me in resolving the issue. I have taken backup using the below command $ tar cvf - . |compress -> /opt/globusback2/needed_backups/apglsg.tar.Z I tried to restore the backup using the below command. $ zcat /opt/globusback2/needed_backups/apglsg.tar.Z | tar -xvf - ... (2 Replies)
Discussion started by: amirthraj_12
2 Replies

9. Solaris

Restoring TAR'd file to different location

Is it possible to restore a TAR'ed file off of a tape to a location other than the original location? If so, how? (The MAN pages give examples of how to restore only to the originating location.) Thanks!! (1 Reply)
Discussion started by: FredSmith
1 Replies

10. UNIX for Dummies Questions & Answers

Restoring a single file...???

Can anyone please help...? Managed to do a ufsdump of files to tape. Having trouble using ufsrestore to pull a single file back by filename?? I have dumped a single file to tape also because looking through the other threads, I noticed that you have to tell it to skip files before you get to... (1 Reply)
Discussion started by: Jonathan
1 Replies
Login or Register to Ask a Question