gabriel <[EMAIL PROTECTED]> writes:
> find . -name "*.tar.gz" -print0 | xargs -0 tar xzf
>
> doesn't do what i would think it should do
> instead it returns the list of tar.gz files with the error:
>
> tar: ./filename0.tar.gz: not found in archive
> tar: ./filename1.tar.gz: not found in archive
> tar: ./filename2.tar.gz: not found in archive
> tar: ./filename3.tar.gz: not found in archive
> tar: ./filename4.tar.gz: not found in archive
> ...
'tar' interprets the first following argument (./filename-1.tar.gz
when staying with your terminology) as the value of the 'f' option,
that is, as the archive it should use.
All *other* arguments are interpreted as files *within* that archive,
which tar tries to find and unpack. Obivously, files by that name do
not exist within the first archive.
('xargs' fills up as many arguments as space-wise possible on one
command line.)
The simplest possible modification to make the command behave as you
intend is to tell 'xargs' to only write one argument per invocation:
find . -name "*.tar.gz" -print0 | xargs -0 -n 1 tar xzf
'xargs -n <foo>' tells xargs to only print <foo> arguments for each
execution; one in ourg case.
So long,
Joe
--
"I use emacs, which might be thought of as a thermonuclear
word processor."
-- Neal Stephenson, "In the beginning... was the command line"
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list