1748149 Members
3650 Online
108758 Solutions
New Discussion юеВ

gunzip tgz problems

 
SOLVED
Go to solution
Donald Thaler
Super Advisor

gunzip tgz problems

why doesnt this work?
/usr/contrib/bin/gunzip icu4c-3_6-src.tgz|tar xvf /usr/local/include

getting this error:
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
9 REPLIES 9
Pete Randall
Outstanding Contributor
Solution

Re: gunzip tgz problems

You're trying to untar /usr/local/include???


Pete

Pete
Kapil Jha
Honored Contributor

Re: gunzip tgz problems

u will have to use xargs(1)
see if this works
#gunzip xxx.tgz|xargs tar xvf

Any way u can do it in 2 commands ;)
BR,
Kapil
I am in this small bowl, I wane see the real world......
Donald Thaler
Super Advisor

Re: gunzip tgz problems

i wanted to place the output of the tar in
/usr/local/include ...

i was able to unzip the file which created a icu4c-3_6-src.tar file, and then i did a 'tar xvf icu4c-3_6-src.tar' and copied the resulting directory into /usr/local/include..



Tim Nelson
Honored Contributor

Re: gunzip tgz problems

you really cannot redirect the contents of an untar.

Tar achives are either absolute or relative and will restore including their archived paths.

If it is relative the tar will extract into the current directory. cd to change the directory.

And as mentioned, -f is the name of the tar file and in this case will attempt to extract from /usr/local/include which is a directory and not a tar file.


man tar

Peter Nikitka
Honored Contributor

Re: gunzip tgz problems

Hi,

a possible better solution:
cd /usr/local/include
/usr/contrib/bin/gunzip < /FULLPATH/icu4c-3_6-src.tgz | tar xf -

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Steven Schweda
Honored Contributor

Re: gunzip tgz problems

> why doesn[']t this work?

Because it's nonsense?.

What, exactly, are you trying to do?

> a possible better solution:
> [...]

Or, depending on what you really want to do,
possibly:

( cd /usr/local/include ; \
gzip -dc valid/path/to/icu4c-3_6-src.tgz | \
tar xf - )

But plopping junk directly into
/usr/local/include sounds like a bad idea, in
general.
Dennis Handly
Acclaimed Contributor

Re: gunzip tgz problems

>I wanted to place the output of the tar in
/usr/local/include

What's in the tarfile? Are the paths relative or absolute?
If you need to change the paths, you can use pax's: -s:old:new:

>Tim: you really cannot redirect the contents of an untar.

Sure you can. It's called pax(1). :-)

Peter: gunzip < /FULLPATH/icu4c-3_6-src.tgz | tar xf -

Right. I typically use gzcat:
gzcat /FULLPATH/icu4c-3_6-src.tgz | tar -xf -
Steven Schweda
Honored Contributor

Re: gunzip tgz problems

> Sure you can. It's called pax(1). :-)

Or GNU "tar", but sometimes it get tiring to
recommend the same old solutions every time,
especially when the original problem
statement lacks enough detail to let anyone
discern what really needs to be done.
Donald Thaler
Super Advisor

Re: gunzip tgz problems

becuase of my ignorance of unix i did ask a stupid question, i thought i could untar into a directory not realizing that the directory was already specified in the tar file..