home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1248 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  2.3 KB

  1. From: danj1@cbnewse.ATT.COM (Dan Jacobson)
  2. Newsgroups: news.newusers.questions,alt.sources
  3. Subject: Macro for Somewhat Better "=" (list subjects) in rn newsreader
  4. Message-ID: <14528@cbnewse.ATT.COM>
  5. Date: 1 May 90 22:02:24 GMT
  6.  
  7. # This is a shell archive.  Remove anything before this line,
  8. # then unpack it by saving it in a file and typing "sh file".
  9. #
  10. # Wrapped by danj1 on Tue May  1 17:02:28 CDT 1990
  11. # Contents:  ...subjects
  12.  
  13. echo x - ...subjects
  14. sed 's/^@//' > "...subjects" <<'@//E*O*F ...subjects//'
  15. : Dan_Jacobson@ATT.COM 5/1990
  16.  
  17. # A semi-stupid quick'n'dirty UNIX netnews subject gatherer for inside
  18. # rn, because rn's "=" isn't good enough.  Gives the count, in
  19. # descending order, of each subject in a newsgroup.  This program
  20. # takes a few seconds to run. It also doesn't look in your .newsrc
  21. # file, so it just lists all subjects, read and unread. Sample output
  22. # [while in newsgroup soc.singles]:
  23.  
  24. #   32 is monogamy passe?
  25. #   16 bathroom needs (was: meeting women)
  26. #   15 isis position paper on homosexuality
  27. # etc.
  28.  
  29. # [I bet I'm not the first to make this macro/program, and is there a
  30. # new release of rn that does it?]  It is called by an rn macro so
  31. # that it executes in the newsgroup's spool directory, which I assume
  32. # you have access to (e.g., probably not accessible if you're running
  33. # rrn).  Lists all subjects, read and unread.  To bind this to ":",
  34. # put this line in your .rnmac file (with the ":" the first thing on
  35. # the line):
  36.  
  37. #         : %(%m=[nap]?%(%m=n?.)!!...subjects^j)
  38.  
  39. # and call this file [that you are reading] "...subjects" and put it
  40. # in your UNIX $PATH.
  41.  
  42. test -z "$PAGER" && PAGER="eval echo; cat"
  43. #echo: else output looks ugly when called from newsgroup selection level.
  44.  
  45. W='[     ][     ]*' #white space
  46. sed "
  47.     /^Subject/!d
  48.     s/$W$//
  49.     s/$W/ /g
  50.     s/ [Rr][Ee]: / /g
  51.     s/ [Rr][Ee]^2: / /g
  52.     s/ [Rr][Ee] / /g
  53.     s/Subject: //g
  54.     y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/
  55.     " * | sort | uniq -c | sort -nr | $PAGER
  56. @//E*O*F ...subjects//
  57. chmod u=rwx,g=rx,o=rx ...subjects
  58.  
  59. echo Inspecting for damage in transit...
  60. temp=/tmp/shar$$; dtemp=/tmp/.shar$$
  61. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  62. cat > $temp <<\!!!
  63.      41    252   1454 ...subjects
  64. !!!
  65. wc  ...subjects | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
  66. if [ -s $dtemp ]
  67. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  68. else echo "No problems found."
  69. fi
  70. exit 0
  71.