Unix administration - create tar from stdin

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > December 2006 > create tar from stdin





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author create tar from stdin
Hauke Fuhrmann

2006-12-20, 1:18 pm

Hi there,

anyone has a hint:

I have an uncompressed tar file and need to get it to a tar.gz.
Looks like tar cannot read from stdin when creating files. is that right?

tar -xvf in.tar --to-stdout | tar czvf out.tar.gz -
tar: -: Cannot stat: No such file or directory

Second try: pipe to gzip:
tar -xvf in.tar --to-stdout | gzip > out.tar.gz

This works, but I cannot untar it:
tar tvzf out.tar.tz
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
tar: Read 7265 bytes from out.tar.gz
tar: Error exit delayed from previous errors
Return value: 2

What do I do wrong? I need it in this form so that Java can open it,
because it shall be a jar file.

Best regards,
Hauke
Jerry Peters

2006-12-20, 7:21 pm

Hauke Fuhrmann <haf@informatik.uni-kiel.de> wrote:
> Hi there,
>
> anyone has a hint:
>
> I have an uncompressed tar file and need to get it to a tar.gz.
> Looks like tar cannot read from stdin when creating files. is that right?
>
> tar -xvf in.tar --to-stdout | tar czvf out.tar.gz -
> tar: -: Cannot stat: No such file or directory
>
> Second try: pipe to gzip:
> tar -xvf in.tar --to-stdout | gzip > out.tar.gz
>
> This works, but I cannot untar it:
> tar tvzf out.tar.tz
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Read 7265 bytes from out.tar.gz
> tar: Error exit delayed from previous errors
> Return value: 2
>
> What do I do wrong? I need it in this form so that Java can open it,
> because it shall be a jar file.
>
> Best regards,
> Hauke


You have a tar file already, you don't need to tar it again, just:
gzip in.tar
should create in.tar.gz

Jerry
Todd H.

2006-12-20, 7:21 pm

Hauke Fuhrmann <haf@informatik.uni-kiel.de> writes:

> Hi there,
>
> anyone has a hint:
>
> I have an uncompressed tar file and need to get it to a tar.gz.
> Looks like tar cannot read from stdin when creating files. is that right?
>
> tar -xvf in.tar --to-stdout | tar czvf out.tar.gz -
> tar: -: Cannot stat: No such file or directory
>
> Second try: pipe to gzip:
> tar -xvf in.tar --to-stdout | gzip > out.tar.gz
>
> This works, but I cannot untar it:
> tar tvzf out.tar.tz
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Read 7265 bytes from out.tar.gz
> tar: Error exit delayed from previous errors
> Return value: 2
>
> What do I do wrong? I need it in this form so that Java can open it,
> because it shall be a jar file.


You may be overthinking this. :-)

$ gzip in.tar
$ mv in.tar.gz in.jar



--
Todd H.
http://www.toddh.net/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com