Thorsten Sch?ning:
> To make things better readable, I would like to have the following
> layout of the same entries instead: 
> 
> ```
> # Some comment...
>         d...@example.org recipient
>       c...@example.org recipient
>     b....@example.org recipient
>   a.b....@example.org recipient
>  aa.b....@example.org recipient
> aaa.b....@example.org recipient
> ```

I should have responded with an example of how one can build a
Postfix table from a user-preferred input form.

$ cat Makefile
virtual.db: virtual.in
        # Note: lines must start with TAB
        tmpfile=`mktemp virtual.XXXX`; \
        sed 's/^[[:space:]]*//' virtual.in > $$tmpfile; \
        postmap $$tmpfile; \
        mv $$tmpfile.db virtual.db
$ cat virtual.in
  a.bbb one
 aa.bbb two
aaa.bbb three
$ make
tmpfile=`mktemp virtual.XXXX`;  sed 's/^[[:space:]]*//' virtual.in > $tmpfile;  
postmap $tmpfile;  mv $tmpfile.db virtual.db
$ postmap -s virtual
aa.bbb  two
a.bbb   one
aaa.bbb three

This example uses `mktemp virtual.XXXX` to avoid disaster when the
there is more than one such command running at the same time.

        Wietse

Reply via email to