From owner-freebsd-questions@FreeBSD.ORG Wed Jan 3 19:24:06 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A20B16A40F for ; Wed, 3 Jan 2007 19:24:06 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id ED8A113C461 for ; Wed, 3 Jan 2007 19:24:01 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (host5.bedc.ondsl.gr [62.103.39.229]) (authenticated bits=128) by igloo.linux.gr (8.13.8/8.13.8/Debian-3) with ESMTP id l03JNZJM018543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 3 Jan 2007 21:23:41 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.13.8/8.13.8) with ESMTP id l03JNSGR007391; Wed, 3 Jan 2007 21:23:29 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.13.8/8.13.8/Submit) id l03JNREV007390; Wed, 3 Jan 2007 21:23:27 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 3 Jan 2007 21:23:27 +0200 From: Giorgos Keramidas To: Kurt Buff Message-ID: <20070103192326.GA7371@kobe.laptop> References: <20070103013416.GA1161@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.462, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.74, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: Batch file question - average size of file in directory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jan 2007 19:24:06 -0000 On 2007-01-03 10:28, Kurt Buff wrote: > I put together this one-liner after perusing 'man zcat': > > find /local/amavis/virusmails -name "*.gz" -print | xargs zcat -l >> out.txt > > It puts out multiple instances of stuff like this: > > compressed uncompr. ratio uncompressed_name > 1508 3470 57.0% stuff-7f+BIOFX1-qX > 1660 3576 54.0% stuff-bsFK-yGcWyCm > 9113 17065 46.7% stuff-os1MKlKGu8ky > ... > ... > ... > 10214796 17845081 42.7% (totals) > compressed uncompr. ratio uncompressed_name > 7790 14732 47.2% stuff-Z3UO7-uvMANd > 1806 3705 51.7% stuff-9ADk-DSBFQGQ > 9020 16638 45.8% stuff-Caqfgao-Tc5F > 7508 14361 47.8% stuff-kVUWa8ua4zxc > > I'm thinking that piping the output like so: > > find /local/amavis/virusmails -name "*.gz" -print | xargs zcat -l | > grep -v compress | grep-v totals > > will do to suppress extraneous header/footer info Sure. This is also better than grabbing the second column unconditionally, which I suggested before :)