Em aqui :
--occurrence[=number]This option can be used in conjunction with one of the subcommands >
--delete,--diff,--extractor--listwhen a list of files is given >either on the command line or via-Toption.This option instructs tar to process only the numberth occurrence of > each named file. Number defaults to 1, so
tar -x -f archive.tar --occurrence filenamewill extract the first occurrence of the member
filename' from >archive.tar' and will terminate without scanning to the end of the archive.
Então, no seu caso, para extrair o uso da versão antiga:
tar -xf test.tar --occurrence=1 1
E para a eliminação,
tar --delete -f test.tar --occurrence=1 1
Outra solução para extrair ambas as versões é simplesmente usar --backup switch:
tar -xf test.tar --backup
Ele irá extrair seus arquivos como:
1
1~
Qual 1~ é o antigo. Se você tiver mais de duas versões, use --occurrence em vez disso.
Você também pode usar -w para usar o modo interativo tar :
tar -xf test.tar -w
Desta vez, tar pergunta por cada ação, você pode escolher a primeira versão ou a última versão a ser extraída por y/n .