home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / unix_c / usenet / archldnw.sh < prev    next >
Encoding:
Text File  |  1989-03-21  |  1.9 KB  |  66 lines

  1. 23-Nov-85 06:12:36-MST,1960;000000000001
  2. Return-Path: <unix-sources-request@BRL.ARPA>
  3. Received: from BRL-TGR.ARPA by SIMTEL20.ARPA with TCP; Sat 23 Nov 85 06:12:32-MST
  4. Received: from usenet by TGR.BRL.ARPA id aa03850; 23 Nov 85 7:40 EST
  5. From: Charlie Perkins <charliep@polaris.uucp>
  6. Newsgroups: net.sources
  7. Subject: Archiving /usr/spool/oldnews
  8. Message-ID: <299@polaris.UUCP>
  9. Date: 22 Nov 85 01:49:49 GMT
  10. To:       unix-sources@BRL-TGR.ARPA
  11.  
  12. =========
  13. Arch_oldnews creates "nice" (but BIG) output
  14. suitable for printing out on a line printer.
  15. I use it to keep hardcopy listings of the
  16. news articles when I expire them, so that
  17. conceivably people could search through the
  18. listings to find interesting articles and
  19. retrieve them from the tapes.  Anyway, it is
  20. useful.  This program grew to about 5 times
  21. its original size and could very reasonably
  22. become a C program now.
  23.  
  24. =================================================
  25. arch_oldnews
  26. =================================================
  27. /bin/rm -f /tmp/arch_oldnews
  28. cat <<'arch_oldnews' > /tmp/arch_oldnews
  29. newsgroup=
  30. export newsgroup
  31. if test -d $1
  32. then
  33.     newsgroup=`echo $1 | sed "s;/usr/spool/oldnews/*;;"`
  34.     (echo   ; echo $newsgroup ; echo " "; echo " ") > /tmp/directoryxyzq
  35. elif test -f $1
  36. then
  37.     subject=`grep '^Subject:' $1 | sed 's/Subject: //
  38.                     1q'`
  39.     case "$subject" in
  40.     "")    exit
  41.     esac
  42.     messageID=`grep '^Message-ID:' $1 | sed 's/^Message-ID: <\(.*\)>/\1/`
  43.     msgsize=`expr "$messageID" : '.*'`
  44.     if test "$msgsize" -ge 16
  45.     then
  46.         tabs="    "
  47.     else
  48.         tabs="        "
  49.     fi
  50.     if test -s /tmp/directoryxyzq
  51.     then
  52.         cat /tmp/directoryxyzq
  53.         cat /dev/null > /tmp/directoryxyzq
  54.     fi
  55.     echo `basename $1`":    $messageID$tabs$subject"
  56. fi
  57. arch_oldnews
  58. chmod 755 /tmp/arch_oldnews
  59. cd /usr/spool/oldnews
  60. find fa net mod na nj -exec /tmp/arch_oldnews {} \;
  61. rm /tmp/arch_oldnews
  62. -- 
  63.  
  64. Charlie Perkins, IBM T.J. Watson Research    philabs!polaris!charliep,
  65.         perk%YKTVMX.BITNET@berkeley,  perk.yktvmx.ibm@csnet-relay
  66.