Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!hoptoad!amdcad!pyramid!decwrl!labrea!rutgers!aramis.rutgers.edu!webber From: webber@aramis.rutgers.edu.UUCP Newsgroups: alt.sources Subject: finding the news articles from message ids Message-ID: <1559@aramis.rutgers.edu> Date: Wed, 16-Sep-87 03:35:04 EDT Article-I.D.: aramis.1559 Posted: Wed Sep 16 03:35:04 1987 Date-Received: Sat, 19-Sep-87 03:10:54 EDT Organization: Rutgers Univ., New Brunswick, N.J. Lines: 81 Keywords: Bourne Shell script spoken here To: webber@aramis.rutgers.edu The universal language for referring to messages in news is by their message ids, which appear on Reference and Message-ID lines of the news headers. However, it is sometimes a nuissance to track down a news message when all you know is its header. Below, I describe a simple way to do this. Enjoy. --------- BOB (webber@aramis.rutgers.edu ; rutgers!aramis.rutgers.edu!webber) #!/bin/sh # This is a usage of the Bourne Shell language to describe an algorithm. # It is not a program. However, on some computers it is very easy to # turn it into a program if you really wanted to. Before doing so, # realize that you really don't know where this file has been or what # devious things have been put into it. You really want to read it # through yourself (and probably change a few things to make it work # better on your machine anyway). # The following shell variable initializations allow me to look at messages # whose message id contains the structure of $1 (on a Sun III), for # example when looking up an article that another article referred to. # The notation for $1 is greppease, which can describe quite a few different # kinds of things. MainNews=/usr/spool/news # The directory where all the news is kept HistoryFile=/usr/lib/news/history # The directory where the news system # keeps track of which message ids went # where Work=$HOME/.FindParent # A seemingly harmless name for scratchspace Temp=$HOME/.FindParentTemp # A different name with the same property if [ $# = 0 ] then echo Usage: \$\1 must be a valid arguement to grep exit else echo Will be searching for $1 fi rm -i $Temp $Work grep $1 $HistoryFile | awk \{print\ \$\4\ \} >$Temp # WARNING: The C version of news will have group info in a different column, # but currently the newsgroup/number is in the 4th column of the # entry in $HistoryFile that was matched. # Translates a newsgroup name into a file name relative to $MainNews tr . / <$Temp >$Work if [ ! -s $Work ] then echo No entry in $HistoryFile containing $1 found. exit fi while [ -s $Work ] do # Shuffle through the lines of $Work in case of multiple matches LoopIndex=`head -1 $Work` tail +2 $Work >$Temp mv $Temp $Work # The user interface, such as it is :-) echo -n Want to try $LoopIndex \(y/n/q\): read Answer if [ $Answer = "y" ] then more $MainNews/$LoopIndex elif [ $Answer = "q" ] then exit fi done exit # That's all there is to it.