Duplicate filenames in tar file, need to extract one at a time - Unix

This is a discussion on Duplicate filenames in tar file, need to extract one at a time - Unix ; Hello, I have a tar file that contains files that were written, then files that were appended to the tar file. The files that were appended share filenames with those that were already in the tar file. I need to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Duplicate filenames in tar file, need to extract one at a time

  1. Duplicate filenames in tar file, need to extract one at a time

    Hello,

    I have a tar file that contains files that were written, then files
    that were appended to the tar file. The files that were appended
    share filenames with those that were already in the tar file. I need
    to pull these files, independently, because extracting the tarball
    will cause the last files written to overwrite the originally written
    files. Here's a more visual example:

    tar tvf 2004-data.tar
    jan04.dat
    feb04.dat
    mar04.dat
    apr04.dat
    mar04.dat
    apr04.dat

    I need to pull the first "mar04.dat" and "apr04.dat" files off, before
    the second set.

    Any help would be appreciated!

    Thanks!

  2. Re: Duplicate filenames in tar file, need to extract one at a time

    On Mar 5, 2:36 pm, cunix wrote:
    > Hello,
    >
    > I have a tar file that contains files that were written, then files
    > that were appended to the tar file. The files that were appended
    > share filenames with those that were already in the tar file. I need
    > to pull these files, independently, because extracting the tarball
    > will cause the last files written to overwrite the originally written
    > files. Here's a more visual example:
    >
    > tar tvf 2004-data.tar
    > jan04.dat
    > feb04.dat
    > mar04.dat
    > apr04.dat
    > mar04.dat
    > apr04.dat
    >
    > I need to pull the first "mar04.dat" and "apr04.dat" files off, before
    > the second set.
    >
    > Any help would be appreciated!
    >
    > Thanks!


    Nevermind! I just missed the correct option, in the man file!

    tar xvfk does what I need:

    -k, --keep-old-files
    keep existing files; don't overwrite them from archive


+ Reply to Thread