Date: Wed, 19 Jul 2006 21:19:04 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Dan Langille <dan@langille.org> Cc: ports@freebsd.org Subject: Re: FreshPorts - scripting help wanted Message-ID: <44BE93B8.4090601@infracaninophile.co.uk> In-Reply-To: <44BE4F89.16402.3BFDA1A6@dan.langille.org> References: <44BE4F89.16402.3BFDA1A6@dan.langille.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE96E0F9CA57A2B8821460734 Content-Type: multipart/mixed; boundary="------------010005040300070209060900" This is a multi-part message in MIME format. --------------010005040300070209060900 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Dan Langille wrote: > Hi folks, >=20 > Some scripting help wanted please. Either Perl or Python. Details=20 > at <http://news.freshports.org/2006/07/19/virtual-categories-have-no- > descriptions/> (also known as <http://tinyurl.com/hhzxh>). Try this. Run it as: cat-parse.pl categories or even cat-parse.pl < categories Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------010005040300070209060900 Content-Type: text/plain; name="cat-parse.pl" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="cat-parse.pl" #!/usr/bin/perl -w use strict; # Read in the categories file from the filehandle passed as the # argument to this function and return a hash keyed on category name # containing category description and group. See # http://www.freebsd.org/cgi/cvsweb.cgi/www/en/ports/categories for # the imput. # sub cat_parse (*) { my $filehandle =3D shift; my %categories; my $c; my $d; my $g; while (<$filehandle>) { next unless ( ( $c, $d, $g ) =3D m/^([^,]+),"([^"]+)",([A-Z]+)/g ); = #" $categories{$c} =3D { DESCR =3D> $d, GROUP =3D> $g }; } return \%categories; } MAIN: { my $categories; $categories =3D cat_parse(ARGV); for my $c ( keys %{$categories} ) { print "$c\t$categories->{$c}{DESCR}\t$categories->{$c}{GROUP}\n";= } } --------------010005040300070209060900-- --------------enigE96E0F9CA57A2B8821460734 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEvpO+8Mjk52CukIwRAw0GAJ0a12rRTlsmEiBSaFiOS65b2sMa6wCglUlB Gsp4NvSewoYzJ9n4f0fmZm0= =F+2m -----END PGP SIGNATURE----- --------------enigE96E0F9CA57A2B8821460734--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44BE93B8.4090601>