From owner-freebsd-questions@FreeBSD.ORG Mon May 2 09:45:45 2005 Return-Path: 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 5E29316A4CE for ; Mon, 2 May 2005 09:45:45 +0000 (GMT) Received: from stdin.stderror.at (stdin.stderror.at [83.65.196.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE71243D55 for ; Mon, 2 May 2005 09:45:44 +0000 (GMT) (envelope-from pinhead@steve.stderror.at) Received: from steve.stderror.at (steve.stderror.at [83.65.196.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by stdin.stderror.at (Postfix) with ESMTP id D430FA157 for ; Mon, 2 May 2005 11:45:43 +0200 (CEST) Received: from steve.stderror.at (localhost [127.0.0.1]) by steve.stderror.at (8.13.1/8.13.1) with ESMTP id j429l17k058792 for ; Mon, 2 May 2005 11:47:01 +0200 (CEST) (envelope-from pinhead@steve.stderror.at) Received: (from pinhead@localhost) by steve.stderror.at (8.13.1/8.13.1/Submit) id j429l051058791 for freebsd-questions@freebsd.org; Mon, 2 May 2005 11:47:00 +0200 (CEST) (envelope-from pinhead) Date: Mon, 2 May 2005 11:47:00 +0200 From: Toni Schmidbauer To: freebsd-questions@freebsd.org Message-ID: <20050502094700.GB30167@stderror.at> Mail-Followup-To: freebsd-questions@freebsd.org References: <200504302348.35647.dfarmour@myrealbox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504302348.35647.dfarmour@myrealbox.com> Phone: +43 664 3502198 X-WWW-Home-Page: http://stderror.at X-PGP-Fingerprint: 53F2 28AE 8070 83E0 AFEC 0ABC BBF9 A34A 3ED1 3287 X-Operating-System: FreeBSD User-Agent: Mutt/1.5.9i Subject: Re: pkg_info output? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: toni@stderror.at List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2005 09:45:45 -0000 On Sat, Apr 30, 2005 at 11:48:35PM -0700, David Armour wrote: > pkg_info | sort | sed -e 's/-[0-9].*$//' | uniq -c | grep -v '^[[:space:]]*1' 0) pkg_info list all packages installed 1) sort sort the resulting list from 0) by package name 2) sed -e 's/-[0-9].*$//' delete everything after a dash followed by a number followed by everything else. so autoconf-2.59_2 becomes autoconf. 3) uniq -c from the manpage: -c Precede each output line with the count of the number of times the line occurred in the input, followed by a single space. so counts how often autoconf is in the list resulting from 2) 4) grep -v '^[[:space:]]*1' delete every line starting (^) with one or more space characters " " followed by 1 in the list resulting from 3) this deletes lines where only 1 version exists, e.g.: 1 borg > 3 autoconf > 3 automake > 6 docbook > 2 gcc > 2 glib > 2 gtk > 2 libtool > 2 perl > 2 xorg-fonts so there are 3 versions of autoconf installed, 3 versions of automake and so on. the script is not quite correct because these two packages are counted as two versions of xorg-fonts: xorg-fonts-100dpi-6.8.2 xorg-fonts-75dpi-6.8.2 homework: find a version that works :-) hth, toni -- Wer es einmal so weit gebracht hat, dass er nicht | toni at stderror dot at mehr irrt, der hat auch zu arbeiten aufgehoert | Toni Schmidbauer -- Max Planck |