Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2002 12:48:31 +0930
From:      Tim Peters <tim@lost.net.au>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        FreeBSD Questions LIST <FreeBSD-Questions@FreeBSD.Org>
Subject:   Re: using xargs to untar
Message-ID:  <20020923031831.GD94594@adelaide.edu.au>
In-Reply-To: <20020922201022.R2138-100000@dhcp-407-32.san.rr.com>
References:  <20020922201022.R2138-100000@dhcp-407-32.san.rr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 22, 2002 at 08:13:22PM -0700, Peter Leftwich wrote:
> # ls -al *.tgz
> -rw-r--r--  1 root  wheel  358995 Sep 22 18:25 z_flash-0.4.10.tgz
> -rw-r--r--  1 root  wheel   27711 Sep 22 18:35 z_plugger-4.0.tgz
> -rw-r--r--  1 root  wheel  309395 Sep 22 18:16 z_yelp-1.0.6.tgz
> 
> # find . -type f
> ./z_flash-0.4.10.tgz
> ./z_yelp-1.0.6.tgz
> ./z_plugger-4.0.tgz
> 
> # find . -type f | xargs -J G tar zxf G
> tar: ./z_yelp-1.0.6.tgz not found in archive
> tar: ./z_plugger-4.0.tgz not found in archive
> 
> What I am trying to do is the equivalent of the following:
> # tar zxf file1.tgz ; tar zxf file2.tgz ; tar zxf file3.tgz

Unfortuantly tar won't work this way as it only expects to operate
on a single tarfile per process, and xargs calls it with all the
files at once.

How about something simpler:

# for f in *.tgz; do tar zxf $f; done

Or if you really want to use find:

# find . -type f -name '*.tgz' -exec tar zxf {} \;

HTH,

-tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020923031831.GD94594>