[Dovecot] Output of dovecot -a not sorted

mouss mouss at netoyen.net
Wed Sep 10 14:41:38 EEST 2008


Charles Marcus wrote:
> Hey Timo,
> 
> I think I've asked you about this before, and I'm sure its not a big
> priority, but this is really a pain when trying to check default settings...
> 
> The output of dovecot -a  is huge, and the fact that it is not sorted
> alphabetically (nor is dovecot -n, but thats not as big of a problem,
> although I'd like to see that sorted as well for consistency) makes it
> really difficult to find certain settings you are looking for.
> 
> Any chance of fixing this so it sorts the output alphabetically?
> 

I guess they are sorted logically.

you can use the perl script below:

# dovecot -n | /path/to/dovesort.pl
auth default:
   mechanisms: ...
   ...
....
verbose_proctitle: yes

========
#!/usr/bin/perl

use strict;

my %out = ();
my $curline = "";

while (<>) {
     chomp;
     if (/^\S/) {
         $curline = $_;
     } elsif ($curline !~ /\S/) {
         print "$_\n";
         next;
     }
     $out{$curline} .= "$_\n";
}
close(DOVE);

foreach (sort keys %out) {
     print $out{$_};
}


More information about the dovecot mailing list