On Sun, Jun 06, 2004 at 03:17:33PM +0200, Matteo D'Alfonso wrote: > Ciao a tutti, > devo sapere quali pacchetti in stable possono appoggiarsi a tcpd, ovvero > quali hanno una dipendenza a libwrap0. > > Se fossi su unstable basterebbe "apt-cache rdepends libwrap0", ma su > stable come faccio? per adesso mi sono arrangiato con aptitude, ma > cercavo un comando da usare in shell e non un interfaccia. cat /var/lib/dpkg/available | \ perl -e 'my $pkg; while (<STDIN>) { if (m/^Package: (.*)$/) { $pkg = $1; } if (m/^Depends: .*?libwrap0.*?$/) { print "$pkg:\n\t$_\n"; } }' io ho indentato il comando tanto per renderlo leggibile, tu mettilo tutto su una riga. Oppure, meglio: ---- 8< ---- 8< ------ #!/usr/bin/perl use strict; my $pkg; my $match = shift; my $file = '/var/lib/dpkg/available'; if (!$match) { &myerror("Parametro assente"); } open(F, "<$file") || die &myerror("?? e tu dove hai il file $file ??"); while (<F>) { if (m/^Package: (.*)$/) { $pkg = $1; } if (m/^Depends: .*?$match.*?$/) { print "$pkg:\n\t$_\n"; } } sub myerror { my $str = shift; print <<EOHELP; Errore: $str Uso: $0 <package> EOHELP exit 0; } ---- 8< ---- 8< ------ aloha -- mattia :wq!
Attachment:
signature.asc
Description: Digital signature