[CentOS] [OT] List of all email users
Ralph Angenendt
ra+centos at br-online.de
Thu Oct 30 15:12:28 UTC 2008
Jussi Hirvi wrote:
> This is not CentOS-specific, hence OT.
>
> I need a list of all email users on my system (there are hundreds of them).
> The list could be extracted from /etc/aliases and the virtusertable.
>
> Does anyone know of a script that would do this automatically? It would have
> to
> - exclude commented-out lines (of course)
> - exclude duplicates
> - produce a list of usernames (or maybe unresolved email addresses for some
> users) separated by a comma
for i in /etc/aliases /etc/postfix/virtual; do
cat $i | grep -Ev "(^#|^\s+$|^$)" | sed -e "s/://" | awk '{print $1}' | \
sort -u | tr \\n ,
done
Adapt to needs.
Ralph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20081030/1c93568f/attachment.sig>
More information about the CentOS
mailing list