From owner-freebsd-questions Sun Sep 22 20:19: 6 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9B8737B401 for ; Sun, 22 Sep 2002 20:19:04 -0700 (PDT) Received: from bloodwood.adelaide.edu.au (bloodwood.adelaide.edu.au [129.127.43.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id B3B2943E6E for ; Sun, 22 Sep 2002 20:19:03 -0700 (PDT) (envelope-from tpeter01@redtail.its.adelaide.edu.au) Received: from redtail.its.adelaide.edu.au ([129.127.46.157]) by bloodwood.adelaide.edu.au (Netscape Messaging Server 4.15) with ESMTP id H2VFVA00.F77; Mon, 23 Sep 2002 12:48:48 +0930 Received: (from tpeter01@localhost) by redtail.its.adelaide.edu.au (8.11.6/8.11.6) id g8N3IVp95086; Mon, 23 Sep 2002 12:48:31 +0930 (CST) (envelope-from tpeter01) Date: Mon, 23 Sep 2002 12:48:31 +0930 From: Tim Peters To: Peter Leftwich Cc: FreeBSD Questions LIST Subject: Re: using xargs to untar Message-ID: <20020923031831.GD94594@adelaide.edu.au> References: <20020922201022.R2138-100000@dhcp-407-32.san.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020922201022.R2138-100000@dhcp-407-32.san.rr.com> User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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