From owner-freebsd-questions@FreeBSD.ORG Sun Jul 25 09:13:00 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38A811065679 for ; Sun, 25 Jul 2010 09:13:00 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id D070B8FC12 for ; Sun, 25 Jul 2010 09:12:59 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.187.76.163]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.4/8.14.4) with ESMTP id o6P9CrdZ043392 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sun, 25 Jul 2010 10:12:54 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) Message-ID: <4C4C000E.8080700@infracaninophile.co.uk> Date: Sun, 25 Jul 2010 10:12:46 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4C4BA855.6070100@comclark.com> In-Reply-To: <4C4BA855.6070100@comclark.com> X-Enigmail-Version: 1.1.1 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2C6A38C85E133C7F5A10FA1D" X-Virus-Scanned: clamav-milter 0.96.1 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_40,DKIM_ADSP_ALL, SPF_FAIL autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lucid-nonsense.infracaninophile.co.uk Subject: Re: searching INDEX in .sh 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: Sun, 25 Jul 2010 09:13:00 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2C6A38C85E133C7F5A10FA1D Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 25/07/2010 03:58:29, Aiza wrote: > I'm looking for a snippet of .sh type shell code that searches the > /usr/ports/INDEX-8 file for dependents. >=20 > Just a pointer to a script in the ports system that has this would be > helpful. grep 'dependency-name' /usr/ports/INDEX.8 | grep -v '^dependency-name' If you don't want the whole INDEX line, add something like this to the above to extract specific columns: | cut -d '|' -f 1 Note that you want the dependency package name, not the directory name in the ports tree -- although most of the time they are the same, there are some important packages where that isn't the case, eg. databases/mysql51-server vs mysql-server-5.1.48 Actually, all you want is sufficient leading prefix from the package name to identify it uniquely, which usually, but not always, means you don't need to include the version number part This will include build dependencies as well as run- or lib- dependencies: if that's not what you want, then use cut(1) to get rid of the last two columns before passing the INDEX through grep(1) Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enig2C6A38C85E133C7F5A10FA1D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxMABUACgkQ8Mjk52CukIyWWwCgju8qyPDuPJMLsUqVgR89rI1R rjkAn2QhE+3R2jN/5ORoXZkaztWGqYWB =3a2O -----END PGP SIGNATURE----- --------------enig2C6A38C85E133C7F5A10FA1D--