Date: Sun, 25 Jul 2010 10:12:46 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: searching INDEX in .sh Message-ID: <4C4C000E.8080700@infracaninophile.co.uk> In-Reply-To: <4C4BA855.6070100@comclark.com> References: <4C4BA855.6070100@comclark.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C4C000E.8080700>
