I log all incoming connections to my opennap server to a postgres database. I get about 625,000 connections per day, and I wanted to sort them by domain so that I could see visually in text where they were coming from. So I'll spare you the database calls. This, however, was a cool little hack to print the hosts out sorted by domain (rather than hostname). You can easily use File::Slurp to write the scalar obtained.
my $noodle = join "$/", map { sprintf "%64s", $_ } ( sort { reverse($a +) cmp reverse($b) } (keys %hosts) );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sort a long list of hosts by domain
by japhy (Canon) on Jun 23, 2001 at 20:42 UTC | |
by John M. Dlugosz (Monsignor) on Jun 25, 2001 at 22:04 UTC | |
by japhy (Canon) on Jun 25, 2001 at 22:22 UTC | |
Re: Sort a long list of hosts by domain
by Brovnik (Hermit) on Jun 24, 2001 at 00:18 UTC | |
Re: Sort a long list of hosts by domain
by mdillon (Priest) on Jun 23, 2001 at 21:18 UTC |
Back to
Cool Uses for Perl