Thanks, but this is exactly the case that introduces subtle problems. It doesn't help if there is another file in the archive, with the same name but in a different directory.
Like here: === mkdir -p dir echo member1 > member1 echo member2 > member2 echo "member1 in directory" > dir/member1 gnutar cf test.tar member1 member2 dir gnutar xOf test.tar --wildcards --no-anchored member1 > member1-extracted === There exists no general way to extract precisely the root member1, which at the same time supports archives with "./member1" path. We can tailor a command line to a specific archive, but this doesn't solve the general case. On Tue, Dec 11, 2018 at 9:31 PM Sergey Poznyakoff <g...@gnu.org.ua> wrote: > > Viktor Sergiienko <singa...@gmail.com> ha escrit: > > > > $ tar tvf archive1.tar > > > -rw-r--r-- root/root 567 2016-09-18 14:28 member1 > > > -rw-r--r-- root/root 1696 2016-09-18 14:28 member2 > > > $ tar tvf archive2.tar > > > -rw-r--r-- root/root 567 2016-09-18 14:28 ./member1 > > > -rw-r--r-- root/root 1696 2016-09-18 14:28 ./member2 > > > > > > How to extract member1 reliably from either of two archives? > > Use the --no-anchored option. > > Regards, > Sergey