[Dovecot] Sort output of dovecot -n alphabetically?

Bjorge Dijkstra bjd at jooz.net
Thu May 22 16:43:23 EEST 2008


On Thu, May 22, 2008 at 09:08:13AM -0400, Charles Marcus wrote:
> On 5/22/2008 8:57 AM, Jens Dönhoff wrote:
>>> Is there a way? Postfix does this by default, and it makes it much
>>> less likely to miss/overlook a setting...
>
>> Just pipe it through sort:
>>
>> dovecot -n | sort
>
> But then *everything* gets sorted (I tried before posting), so its not  
> acceptable solution:
>
> host ~ # dovecot -n | sort
> # 1.1.rc5: /etc/dovecot/dovecot.conf
>     args: *
> auth default:
>     driver: pam
>     driver: passwd
> listen: [::]
> login_dir: /var/run/dovecot/login
> login_executable: /usr/libexec/dovecot/imap-login
> mail_location: maildir:~/.maildir
>   passdb:
> ssl_cert_file: /etc/ssl/dovecot/server.pem
> ssl_key_file: /etc/ssl/dovecot/server.key
>   userdb:
>
> And no, this is not complete output...
>

The following seems to work reasonably well:
dovecot -n | sed -n '1h;2,$H;${g;s/\n /xnlx/g;p}' | sort | sed 's/xnlx/\n/g'

Not my invention though, just got this contraption from somewhere else..

regards,
Bjorge



More information about the dovecot mailing list