home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / unix_c / usenet / whatisin.sh < prev   
Encoding:
Text File  |  1989-03-21  |  2.5 KB  |  64 lines

  1. 14-Dec-85 12:07:18-MST,2564;000000000001
  2. Return-Path: <unix-sources-request@BRL.ARPA>
  3. Received: from BRL-TGR.ARPA by SIMTEL20.ARPA with TCP; Sat 14 Dec 85 12:07:14-MST
  4. Received: from usenet by TGR.BRL.ARPA id a001691; 14 Dec 85 13:23 EST
  5. From: Greg Earle <earle@smeagol.uucp>
  6. Newsgroups: net.sources
  7. Subject: whatisin - Script for quickly identifying contents of news articles
  8. Message-ID: <518@smeagol.UUCP>
  9. Date: 12 Dec 85 03:28:29 GMT
  10. To:       unix-sources@BRL-TGR.ARPA
  11.  
  12. Here's a handy little script I use to at-a-glance see what is in
  13. the news articles that are currently available in a newsgroup or
  14. groups.  For some groups (like this one), I keep archives for a ways
  15. back, so even though I've read the articles, I might want to go
  16. back to one and build the tool that was in it.  I use this script
  17. to peruse the contents of a group or groups, to see which articles
  18. have what I'm looking for (or not looking for) in it.  The number of
  19. the article is given, along with a summary taken from the header
  20. 'Subject:' line.  The output of this script is suitable for page or more.
  21.  
  22.     Greg Earle
  23.     Jet Propulsion Laboratory, Spacecraft Data Systems group
  24.     UUCP: ..!sdcrdcf!smeagol!earle
  25.     ARPA: ia-sun2!smeagol!earle@cit-vax.arpa
  26.  
  27. ------------ Cut Here ----- Cut Here ------------------
  28. #! /bin/sh
  29. #
  30. # whatisin : Bourne Shell script to tell you what is the contents
  31. # of a particular news group.  Uses the Subject: header line (presumed
  32. # to be the best indicator).
  33. # Called via 'whatisin <newsgroup> <newsgroup2> ...', 
  34. # e.g. 'whatisin net.sources.bugs'
  35.  
  36. # Edit next line as appropriate for your system
  37. NEWSDIR="/usr/spool/news"
  38. for i in $*
  39. do
  40. #    There are newlines inserted here via ^V^J
  41.     echo "
  42.         Contents of" $i ":
  43. "
  44.     DESTDIR=`echo $i | sed 's?\.?/?g'`
  45.     cd ${NEWSDIR}/$DESTDIR
  46. # We look at all the files in the directory the slow way, because
  47. # if you keep news archives for certain directories around for a while,
  48. # (like I do at this site), you may have too many files, and a
  49. # grep * will blow up on "too many arguments"
  50.     for a in 1 2 3 4 5 6 7 8 9
  51.     do
  52.         if [ -f ./${a}* ]
  53.         then
  54. #            Note that this next line is broken by postings that contain
  55. #            Mail headers from previous posts that contain a ^Subject:
  56. #            line in the included mail message.  In some cases this is
  57. #            not necessarily a bad thing, try running this on a digested
  58. #            news group like mod.computers.sun/Sun-Spots
  59.             grep "^Subject:" ${a}* /dev/null | sed 's/Subject://g' 
  60.         fi
  61.     done | sort -n 
  62.     echo "--------------------------------------------------------------"
  63. done
  64.