bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [PATCH] Re: Extracting only the first matching file: --occurre


From: Alex Bligh
Subject: [Bug-tar] [PATCH] Re: Extracting only the first matching file: --occurrence bug?
Date: Tue, 2 Jul 2013 20:26:32 +0100

I wrote a patch in case the behaviour of --occurrence is intentional.
This patch allows --to-stdout to extract precisely one file rather
than a concatenation of a lot of files. This is particularly useful
when excluding files, as --occurrence matches excluded files too;
also to use --occurrence you need to pass a list of files with a '*'
in and turn wildcards on, if you are not passing a list of files.

Example (a tar file whose constituent files each contain the
text equal to their filename):

$ src/tar tf test.tar
ignore
hello
world
$ src/tar -x --to-stdout -f test.tar
ignore
hello
world
$ src/tar -x --to-stdout=1 -f test.tar
ignore
$ src/tar -x --to-stdout=2 -f test.tar
hello
$ src/tar -x --to-stdout=3 -f test.tar
world
$ src/tar -x --to-stdout=1 -f test.tar --exclude=ignore
hello


Alex Bligh (1):
  Add optional numeric argument to -O / --to-stdout

 doc/tar.texi  |   21 ++++++++++++++-------
 src/common.h  |    2 ++
 src/extract.c |    4 ++++
 src/tar.c     |   14 ++++++++++++--
 4 files changed, 32 insertions(+), 9 deletions(-)

-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]