home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.mail.elm
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!wupost!usc!rpi!newsserver.pixel.kodak.com!kodak!clpd.kodak.com!obelix!thomas
- From: thomas@obelix (bulli@kodak.com)
- Subject: AWK for mailrc->aliases.text
- Message-ID: <1992Jul27.180842.14972@clpd.kodak.com>
- Sender: news@clpd.kodak.com
- Nntp-Posting-Host: obelix
- Reply-To: bulli@kodak.com
- Organization: Eastman Kodak Co. - Clinical Products Division
- X-Newsreader: Tin 1.1 PL4
- Date: Mon, 27 Jul 1992 18:08:42 GMT
- Lines: 97
-
-
- I have slightly improved the original awk script for copying aliases from a
- mailrc to aliases.text:
-
- #
- # @(#)$Id: mailrc.awk,v 4.1 90/04/28 22:44:44 syd Exp $
- # Copyright (c) 1986, 1987 Dave Taylor
- # Copyright (c) 1988, 1989, 1990 USENET Community Trust
- # Bug reports, patches, comments, suggestions should be sent to:
- #
- # Syd Weinstein, Elm Coordinator - elm@DSI.COM
- # dsinc!elm
- #
- # $Log: mailrc.awk,v $
- # Revision 4.1 90/04/28 22:44:44 syd
- # checkin of Elm 2.3 as of Release PL0
- #
- #
- # Changed: 27-Jul-92, Thomas Bullinger (bulli@kodak.com)
- # Changed to copy comment lines with "MSG" as second item
- # from the ".mailrc" file into "aliases.text"
- # Ex.: # MSG Private aliases
-
-
- BEGIN {
- print "# MSG alias_text file, from a .mailrc file..."
- }
-
- next_line == 1 {
-
- next_line = 0;
- group = ""
- for (i = 1; i <= NF; i++) {
- if (i == NF && $i == "\\") sep = ""
- else sep = ", "
-
- if ($i == "\\") {
- group = sprintf("%s,", group)
- next_line = 1;
- }
- else if (length(group) > 0)
- group = sprintf("%s%s%s", group, sep, $i);
- else
- group = $i;
- }
- print "\t" group
-
- }
-
- $1 ~ /[Aa]lias|[Gg]roup/ {
-
- if ( NF == 3)
- print $2 " = user alias = " $3;
- else {
- group = ""
- for (i = 3; i <= NF; i++) {
- if (i == NF && $i == "\\") sep = ""
- else sep = ", "
-
- if ($i == "\\") {
- group = sprintf("%s,", group)
- next_line = 1;
- }
- else if (length(group) > 0)
- group = sprintf("%s%s%s", group, sep, $i);
- else
- group = $i;
- }
- print $2 " = group alias = " group;
- }
- }
-
- # Appended to copy comment line(s), Thomas Bullinger
-
- $1 ~ /#/ && $2 == "MSG" {
- print ""
- printf ("# ")
- for (i = 3; i <= NF; i++) {
- printf ("%s ", $i)
- }
- print ""
- }
-
- --
- ______ __ _ _
- / / / ) // //
- / /_ __________ __. _ /--< . . // // o ____ _, _ __
- (_/ / /_(_) / / / <_(_/|_/_) /___/_(_/_</_</_<_/ / <_(_)_</_/ (_
- /|
- |/
- +-------------------------------------------------------------------------+
- | Thomas Bullinger | bulli@kodak.com (primary international TCP/IP) |
- | (716)253-7958 | bulli@banana.ithaca.ny.us (secondary TCP/IP) |
- | | 76535.2221@compuserve.com (international network) |
- +-------------------------------------------------------------------------+
- | Don't worry, be happy |
- +----------------------------------------------+
-