Commit 6cafcb75 authored by taggart's avatar taggart

new script to list top lists with addresses in a particular domain

parent 20228c9d
#!/usr/bin/perl -w
# topdomcount - for a given domain, list the top lists with subscribers in
# that domain
# NOTE: this script requires the current user has read access to the db
# Matt Taggart <> 2019-08
$listsql='mysql -N --batch --database=sympa --execute "select user_subscriber,list_subscriber from subscriber_table"';
if ( ! $ARGV[0] ) {
print "usage: topdomcount <domain>\n";
exit 1;
$target = $ARGV[0];
open(LISTDUMP, "$listsql|") or die "cannot get dump of address+list pairs from database\n";
while (<LISTDUMP>) {
# match sane address and list
if ( $domain eq $target ) {
# hash, key is list, value is number of subscriber
# sort by number of lists subscribed
foreach $list ( sort { $domcount{$b} <=> $domcount{$a} } keys %domcount) {
print "$list ", $domcount{$list}, "\n";
if ( $count == $limit ) {last;}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment