Subject: Re: A small utility to easily browse the available packages?
To: Beaker <beaker@myrealbox.com>
From: Stephane Bortzmeyer <bortzmeyer@nic.fr>
List: netbsd-help
Date: 08/13/2003 10:04:28
On Wed, Aug 06, 2003 at 08:32:47AM -0700,
 Beaker <beaker@myrealbox.com> wrote 
 a message of 18 lines which said:

> # useage: 'findpkg <keyword>'
> #
> /usr/pkg/bin/lynx -dump -nolist ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/README-all.html  | /usr/bin/grep ${1}

Good idea. Thanks. Here is the zsh function I finally wrote and that I
like. It uses the fact that INDEX is structured, allowing you to
tailor your presentation. It also uses wget instead of lynx which has
the stupid habitud of formatting the output (and -width does not work
when there are very long lines).

findpkg() {
      wget --quiet -O - ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/INDEX  | \
         grep -i "^[^\|]*$1" | \
         awk -F\| '{print $1 " (" $4 ")"}'
}

rachel:~ % findpkg  dns
adns-1.0 (Asynchronous-capable DNS client library and utilities)
djbdns-1.05nb2 (Collection of secure and reliable DNS tools by Dan Bernstein)
dnstop-20021224nb1 (Diagnose tcpdump trace for DNS queries/replies)
dnstracer-1.7 (Tool to trace dns queries)
p5-DNS-ZoneParse-0.82 (Perl5 module for parsing DNS zone files)
p5-Net-DNS-0.33 (Net::DNS - Perl DNS Resolver Module)
py22-adns-python-1.0.0 (Python interface to the GNU asynchronous DNS resolver library)
py22-dns-1.0.0 (Python DNS toolkit)