From owner-freebsd-questions Tue Sep 21 5:21:59 1999 Delivered-To: freebsd-questions@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 9C8171574E for ; Tue, 21 Sep 1999 05:21:56 -0700 (PDT) (envelope-from bright@wintelcom.net) Received: from localhost (bright@localhost) by fw.wintelcom.net (8.9.3/8.9.3) with ESMTP id FAA24056; Tue, 21 Sep 1999 05:33:19 -0700 (PDT) Date: Tue, 21 Sep 1999 05:33:19 -0700 (PDT) From: Alfred Perlstein To: Langa Kentane Cc: FreeBSD , Linux Subject: Re: Aliases file administration In-Reply-To: <000701bf041a$23c29a00$07a8ef9b@sunnet.co.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 21 Sep 1999, Langa Kentane wrote: > Hi all. > > I my mail server hosts about 600 hundred users with each user allowed to > have up to five aliaes. Is there some front end program that I can use to > manipulate my aliases file and be able to sort the aliases by order of the > user the address is aliased to. I want to be able to see how many aliases > each user has and if they have gone over the limit. > > Can you guys please suggest such an app for me. ---------------------------- #!/usr/bin/perl require 5.004; while ($_ = ) { next if /^[ \t]*(#.*)?$/ ; #skip blank and comment only lines $_ =~ s/(#.*)|(^ *)//g; # remove comments and leading ws $_ =~ s/[ :,\t][ :,\t]*/ /g; chomp; $line = $_; @x = reverse(split(/ /,$line)); $alias = pop(@x); while ($user = pop(@x)) { print "$user $alias\n"; } } ---------------------------- run this perl script in a pipeline like so: this_script.pl < /etc/aliases | sort -Alfred Perlstein - [bright@rush.net|alfred@freebsd.org] Wintelcom systems administrator and programmer - http://www.wintelcom.net/ [bright@wintelcom.net] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message