home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / mail / elm / 2008 < prev    next >
Encoding:
Text File  |  1992-07-27  |  3.1 KB  |  111 lines

  1. Newsgroups: comp.mail.elm
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!wupost!usc!rpi!newsserver.pixel.kodak.com!kodak!clpd.kodak.com!obelix!thomas
  3. From: thomas@obelix (bulli@kodak.com)
  4. Subject: AWK for mailrc->aliases.text
  5. Message-ID: <1992Jul27.180842.14972@clpd.kodak.com>
  6. Sender: news@clpd.kodak.com
  7. Nntp-Posting-Host: obelix
  8. Reply-To: bulli@kodak.com
  9. Organization: Eastman Kodak Co. - Clinical Products Division
  10. X-Newsreader: Tin 1.1 PL4
  11. Date: Mon, 27 Jul 1992 18:08:42 GMT
  12. Lines: 97
  13.  
  14.  
  15. I have slightly improved the original awk script for copying aliases from a
  16. mailrc to aliases.text:
  17.  
  18. #
  19. # @(#)$Id: mailrc.awk,v 4.1 90/04/28 22:44:44 syd Exp $
  20. #    Copyright (c) 1986, 1987 Dave Taylor
  21. #    Copyright (c) 1988, 1989, 1990 USENET Community Trust
  22. # Bug reports, patches, comments, suggestions should be sent to:
  23. #
  24. #    Syd Weinstein, Elm Coordinator - elm@DSI.COM
  25. #                     dsinc!elm
  26. #
  27. # $Log:    mailrc.awk,v $
  28. # Revision 4.1  90/04/28  22:44:44  syd
  29. # checkin of Elm 2.3 as of Release PL0
  30. #
  31. # Changed: 27-Jul-92, Thomas Bullinger (bulli@kodak.com)
  32. #          Changed to copy comment lines with "MSG" as second item
  33. #            from the ".mailrc" file into "aliases.text"
  34. #          Ex.: # MSG Private aliases
  35.  
  36.  
  37. BEGIN { 
  38.     print "# MSG alias_text file, from a .mailrc file..." 
  39.       }
  40.  
  41. next_line == 1 { 
  42.  
  43.     next_line = 0;
  44.         group = ""
  45.     for (i = 1; i <= NF; i++) {
  46.       if (i == NF && $i == "\\") sep = ""
  47.       else                       sep = ", "
  48.     
  49.       if ($i == "\\") {
  50.         group = sprintf("%s,", group)
  51.         next_line = 1;
  52.       }
  53.       else if (length(group) > 0)
  54.         group = sprintf("%s%s%s", group, sep, $i);
  55.       else
  56.         group = $i;
  57.       }
  58.       print "\t" group
  59.  
  60.     }
  61.  
  62. $1 ~ /[Aa]lias|[Gg]roup/ { 
  63.  
  64.     if ( NF == 3)
  65.       print $2 " = user alias = " $3;
  66.     else {
  67.       group = ""
  68.       for (i = 3; i <= NF; i++) {
  69.         if (i == NF && $i == "\\") sep = ""
  70.         else        sep = ", "
  71.     
  72.         if ($i == "\\") {
  73.            group = sprintf("%s,", group)
  74.            next_line = 1;
  75.         }
  76.         else if (length(group) > 0) 
  77.            group = sprintf("%s%s%s", group, sep, $i);
  78.         else
  79.            group = $i;
  80.         }
  81.         print $2 " = group alias = " group;
  82.       }
  83.      }
  84.  
  85. # Appended to copy comment line(s), Thomas Bullinger
  86.  
  87. $1 ~ /#/ && $2 == "MSG" {
  88.     print ""
  89.     printf ("# ")
  90.     for (i = 3; i <= NF; i++) {
  91.         printf ("%s ", $i)
  92.         }
  93.     print ""
  94.     }
  95.  
  96. --
  97.   ______                             __        _  _
  98.     /   /                           /  )      // //
  99.    /   /_  __________  __.  _      /--<  . . // // o ____  _,  _  __
  100. (_/   / /_(_) / / / <_(_/|_/_)    /___/_(_/_</_</_<_/ / <_(_)_</_/ (_
  101.                                                          /|
  102.                                                         |/
  103. +-------------------------------------------------------------------------+
  104. | Thomas Bullinger | bulli@kodak.com       (primary international TCP/IP) |
  105. | (716)253-7958    | bulli@banana.ithaca.ny.us         (secondary TCP/IP) |
  106. |                  | 76535.2221@compuserve.com    (international network) |
  107. +-------------------------------------------------------------------------+
  108.              |          Don't worry, be happy               |
  109.              +----------------------------------------------+
  110.