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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-26-2007, 12:26 PM
|
#1
|
|
Member
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38
Rep:
|
Getting GNU Tar to stop when file is found
Hello,
Here is my dilemma. When I use GNU tar (version 1.16 - standard with Slackware 10.2) to extract a particular file from a tape archive, GNU tar continues to search the tape even after the desired file has been extracted. Is there a way to make it quit once the first occurrence has been found? I've searched the GNU tar manual and Googled it to death but have come across nothing. It is frustrating watching my restore script still executing long after the file has been restored.
Thanks,
GL
|
|
|
|
02-26-2007, 04:05 PM
|
#2
|
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
Haven't tested it, but this (from tar(1) manpages) sounds promising:
Quote:
--occurrence NUM
process only NUM occurrences of each named file; used with
--delete, --diff, --extract, or --list
|
|
|
|
|
02-27-2007, 11:10 AM
|
#3
|
|
Member
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38
Original Poster
Rep:
|
Thank you! It looks like it should fit the bill. I've been testing it this morning but haven't gotten it to work correctly yet, even with a simple command like:
tar -x -v --checkpoint=.1000 --occurrence=1 path/to/myfile.txt
For output, I get the checkpoint dots, then the filename once that has been found, then more checkpoint dots for a while afterward. But the --occurrence option seems to be just what I was looking for.
I'll post again once I've figured out what I'm doing wrong.
Thanks,
GL
|
|
|
|
03-30-2007, 02:56 PM
|
#4
|
|
Member
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38
Original Poster
Rep:
|
It turns out I wasn't doing anything wrong. I reported the bug and received the reply:
> I believe there may be a bug with the GNU tar version 1.16 "--occurrence"
> option: it keeps scanning to the end of the tape even after the first
> occurrence of a file is found.
Thanks for reporting. I have fixed it in the repository.
Regards,
Sergey
Thanks,
GL
|
|
|
|
All times are GMT -5. The time now is 06:09 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|