How to extract multiple files from tape


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to extract multiple files from tape
# 1  
Old 10-06-2008
How to extract multiple files from tape

Hello everyone,

I am having difficulties restoring data from a tape and I was hoping someone could help me. Here it goes.
Whenever I type tar -xvf /dev/nst0, only the first file on the tape is restored which means that in the particular tape there are multiple tar files.

Can someone please tell me how can I extract multiple files from a tape?
Is there a command that can restore multiple tar files from a tape without restoring each file seperately?

Thank you, all
# 2  
Old 10-06-2008
Just found this - they are using mt to position the tape at different points:

http://www.gnu.org/software/tar/manu...tion/Many.html
# 3  
Old 10-06-2008
No, I don't know how the files were archived on that tape.
But I am sure, there are more than one files in there because I forwarded the tape using:
mt -f /dev/nst0 fsf 2 and then tar xvf /dev/nst0.
In that case it extracted only the second file on the tape.

If I do mt -f /dev/nst0 fsf 3, then the 3rd file will be extracted.

The problem is that I can't do that for every single file because there are hundreds of them.

If I do tar tvf, it only displays the first file, not everything, that's why I think that the guy who archived it, created more than one tar files.



Can you get the syntax from the one who wrote the multiple tar archives to that tape to get a clue? Also to be sure he could have written them one after one onto the tape instead of overwriting each and having left only one in the end

What does a tar tvf shows only the first file on the tape.? Can you see files from multiple tar archives?
# 4  
Old 10-06-2008
Ah ok. Then I suggest the people that store hundreds of such archives change it to write them all together in one archive to make your work a bit more comfortable, if that is an option.

Also maybe have a while loop for example counting up to 99999 and have it read the archives until an error occurs.
If there is a command to get a clue how many files are on the tape (tctl? mt?), use that number.
# 5  
Old 10-06-2008
A while loop?

Do I have to write a perl script to do that?Smilie
# 6  
Old 10-06-2008
Can you please tell me an easy way to do that?Smilie
I am not good with scripting.
# 7  
Old 10-06-2008
I just looked around and found this: for a in `ls -1 *.tar.gz`; do tar -zxvf $a; done
but when I run it i got the error:
tar.gz file doesn't exist.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Restore files from tape with multiple positions

I have lots of tapes where files got written to X amount of positions per tape. Is there a way to restore all files on the tape regardless of position ID? Right now to restore files in the first position I do mt -f /dev/nst0 fsf 1 tar -xvf /dev/nst0 I'd really like if there was a... (3 Replies)
Discussion started by: whegra
3 Replies

2. Shell Programming and Scripting

Extract data in tabular format from multiple files

Hi, I have directory with multiple files from which i need to extract portion of specif lines and insert it in a new file, the new file will contain a separate columns for each file data. Example: I need to extract Value_1 & Value_3 from all files and insert in output file as below: ... (2 Replies)
Discussion started by: belalr
2 Replies

3. Shell Programming and Scripting

Compare multiple files, and extract items that are common to ALL files only

I have this code awk 'NR==FNR{a=$1;next} a' file1 file2 which does what I need it to do, but for only two files. I want to make it so that I can have multiple files (for example 30) and the code will return only the items that are in every single one of those files and ignore the ones... (7 Replies)
Discussion started by: castrojc
7 Replies

4. UNIX for Dummies Questions & Answers

Extract common data out of multiple files

I am trying to extract common list of Organisms from different files For example I took 3 files and showed expected result. In real I have more than 1000 files. I am aware about the useful use of awk and grep but unaware in depth so need guidance regarding it. I want to use awk/ grep/ cut/... (7 Replies)
Discussion started by: macmath
7 Replies

5. UNIX for Dummies Questions & Answers

Extract columns from multiple files with a file name as heading

Hi All, I have 7 files, each containing 9 columns separated by space. I want to extract the 9th columns from every file and save in a new file. The columns must be pasted next to each other. And the title of each columns should be the name of the corresponding files! Since the 3rd column is... (1 Reply)
Discussion started by: Unilearn
1 Replies

6. UNIX for Dummies Questions & Answers

awk, extract last line of multiple files

Hi, I have a directory full of *.txt files. I would like to print the last line of every file to screen. I know you can use FNR for printing the first line of each file, but how do I access the last line of each file? This code doesn't work, it only prints the last line of the last file:BEGIN... (5 Replies)
Discussion started by: Liverpaul09
5 Replies

7. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

8. UNIX for Dummies Questions & Answers

AWK, extract data from multiple files

Hi, I'm using AWK to try to extract data from multiple files (*.txt). The script should look for a flag that occurs at a specific position in each file and it should return the data to the right of that flag. I should end up with one line for each file, each containing 3 columns:... (8 Replies)
Discussion started by: Liverpaul09
8 Replies

9. Shell Programming and Scripting

need help with post:extract multiple columns from multiple files

hello, I will would be grateful if anyone can help me reply to my post extract multiple cloumns from multiple files; skip rows and include filenames; awk Please see this thread. Thanks manishabh (0 Replies)
Discussion started by: manishabh
0 Replies

10. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies
Login or Register to Ask a Question