LinuxQuestions.org
Weather apps tell you it'll rain. Wyndo tells you when to go.
Home Forums Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 02-26-2007, 12:26 PM   #1
Gault LaRue
Member
 
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38

Rep: Reputation: 15
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
 
Old 02-26-2007, 04:05 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
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
 
Old 02-27-2007, 11:10 AM   #3
Gault LaRue
Member
 
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38

Original Poster
Rep: Reputation: 15
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
 
Old 03-30-2007, 02:56 PM   #4
Gault LaRue
Member
 
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38

Original Poster
Rep: Reputation: 15
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
 
  


Reply



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 On
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 02:48 AM
need some help with muli-volume tar (ubuntu, bash, gnu tar) MattCarp Linux - General 4 06-05-2006 08:15 AM
GNU R help with converting SPSS file - object not found towsonu2003 Linux - Software 2 03-04-2006 11:30 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM
Help!! Make file:62: *** Linux source not found. Stop. harlemno1 Linux - Newbie 6 03-04-2005 04:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:09 PM.

Contact Us - Advertising Info - Rules - Privacy - Donations - Contributing Member - LQ Sitemap - "Weather apps tell you it'll rain. Wyndo tells you when to go."
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