Untar to one file - Unix

This is a discussion on Untar to one file - Unix ; I have a series of tar (.Z) files which I would like to extract into one file. All the files in the archives are ASCII so there should be no problem combining all the files into on. What would be ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Untar to one file

  1. Untar to one file

    I have a series of tar (.Z) files which I would like to extract into
    one file. All the files in the archives are ASCII so there should be no
    problem combining all the files into on. What would be the easiest way
    to do this?

    Thanks in advance
    ~Andre


  2. Re: Untar to one file

    In <1134050586.436274.16580@g47g2000cwa.googlegroups.c om>,
    andre.cohen@gmail.com wrote:

    > I have a series of tar (.Z) files which I would like to extract into
    > one file. All the files in the archives are ASCII so there should be no
    > problem combining all the files into on. What would be the easiest way
    > to do this?


    Something like ....

    cat filename.tar | tar -Ox >> new-filename

    AC
    --
    In America, through pressure of conformity, there is freedom of choice,
    but nothing to choose from - Peter Ustinov.

  3. Re: Untar to one file

    In ,
    Aawara Chowdhury wrote:

    > In <1134050586.436274.16580@g47g2000cwa.googlegroups.c om>,
    > andre.cohen@gmail.com wrote:
    >
    >> I have a series of tar (.Z) files


    Oops, just saw they are compressed files. So change:

    > cat filename.tar | tar -Ox >> new-filename


    to

    cat filename.tar.Z | uncompress | tar -Ox >> new-filename

    AC
    --
    In America, through pressure of conformity, there is freedom of choice,
    but nothing to choose from - Peter Ustinov.

  4. Re: Untar to one file

    On 2005-12-08, andre.cohen@gmail.com wrote:
    > I have a series of tar (.Z) files which I would like to extract into
    > one file. All the files in the archives are ASCII so there should be no
    > problem combining all the files into on. What would be the easiest way
    > to do this?


    Do you have tar files (usually end with .tar), compressed files
    (end with .Z), or compressed tar files (usually end with .tar.Z)?

    To extract a tar archive to a single file, use the -O option if
    your version of tar has it, or, if not, extract the files into a
    temporary directory then cat them into a single file.

    If they are compressed files, use 'uncompress -c' to uncompress
    them to stdout and redirect that output to a file:

    uncompress -c *.Z > NEWFILE

    If they are compressed tar files, combine the two methods. Some tar
    versions, such as GNU, can uncompress the files as well as
    unarchive them. If you have (or another which will
    uncompress/ungzip compressed files and sent the output to stdout):

    for file in *.tar.Z
    do
    tar -Oxzf "$file"
    done > NEWFILE

    --
    Chris F.A. Johnson, author |
    Shell Scripting Recipes: | My code in this post, if any,
    A Problem-Solution Approach | is released under the
    2005, Apress | GNU General Public Licence

+ Reply to Thread