🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
5 messages
5 total messages Started by Greg Kuperberg Mon, 29 Aug 1994 21:48
Wanted: News searching utility
#11116
Author: Greg Kuperberg
Date: Mon, 29 Aug 1994 21:48
23 lines
1874 bytes
I am interesting a news searching utility, preferably one that does
assume that you want to read much news or mark anything as read.
Here are some typical searches that I might want to do:

1) Someone dumped an egg in my gas tank.  I haven't read rec.autos.*
for ages and I don't plan to stay subscribed, but I would like to search
for all articles in these groups with "egg" in the subject line.

2) I hear that Joe Schmoe is a hip poster in certain groups, so I
would like a list of all available articles that he's posted in groups
with the word "research" in them.

3) There's a new curve-fitting feature in Mathematica, and I would
like a list of all articles posted to sci.math.symbolic with "wri"
in the From line and "fit" in the Subject line.

In each case, I don't want to mark these articles as read or unread,
I don't want all articles BUT these marked as read, and I'm not even
sure I even want the groups in my .newsrc.  In principle, these
searches are reasonably fast with a threaded NNTP server, using
XHDR commands and some computation.  I'm thinking of writing a PERL
script to do the job.  I'd like to know there already is such an
animal.
Re: Wanted: News searching utility
#11133
Author: Christopher Davis
Date: Tue, 30 Aug 1994 14:55
251 lines
9053 bytes
GK> == Greg Kuperberg <gk00@quads.uchicago.edu>

 GK> In principle, these searches are reasonably fast with a threaded NNTP
 GK> server, using XHDR commands and some computation.  I'm thinking of
 GK> writing a PERL script to do the job.  I'd like to know there already
 GK> is such an animal.

Even faster--use XOVER if you have it.  Here's a quick hack I threw
together from parts of other things I'd written.

It just spews out a list of msgids, but those are easily converted into
articles.  Something like 'nnrpArticle' can be easily added to the code.

It could be a lot faster than it is; one proposed extension to LIST would
replace the "download active file and search it" bit.  It could also use
XPAT (under INN) for searches which didn't require regexps.

-f and -s are from, and subject, case insensitive.  -F and -S are case
sensitive.  -g is a group glob list (-g 'uchi.*,comp.mail.*' for example).

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  novgrep.pl nnrpfunc.pl
# Wrapped by ckd@loiosh.kei.com on Tue Aug 30 10:53:47 1994
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'novgrep.pl' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'novgrep.pl'\"
else
echo shar: Extracting \"'novgrep.pl'\" \(1442 characters\)
sed "s/^X//" >'novgrep.pl' <<'END_OF_FILE'
X#!/usr/bin/perl
X
X$nntpserver = $ENV{'NNTPSERVER'} || 'news';
X
Xrequire 'nnrpfunc.pl';
Xrequire 'getopts.pl';
X
X&Getopts('f:s:F:S:g:');
X
Xdie "need at least one of -[fsFS]\n"
X    unless ($opt_f || $opt_s || $opt_F || $opt_S);
X
Xdie "no group list\n"
X    unless $opt_g;
X
X$checksub = 'sub checkForHit {
X    local($overviewline) = @_;
X
X    local($artnum,$subject,$from,$date,$msgid,$bytes,$lines,$rest)=
X	split(/\t/,$overviewline);
X
X    push(@hits,$msgid) if (';
X
Xpush(@checks,"(\$subject =~ /$opt_s/i)") if $opt_s;
Xpush(@checks,"(\$from =~ /$opt_f/i)") if $opt_f;
Xpush(@checks,"(\$subject =~ /$opt_S/)") if $opt_S;
Xpush(@checks,"(\$from =~ /$opt_F/)") if $opt_F;
X
X$checksub .= join(" && ",@checks);
X$checksub .= ");\n}\n";
X
Xeval $checksub;
X
X# turn the @groups into a regex.  (convert wildmat-style)
X@grouppats = split(',',$opt_g);
X
Xforeach (@grouppats) {
X    s/\./\\./g;
X    s/\*/.*/g;
X    s/,/|/g;
X    s/\?/./g;
X}
X
X$grouppat = '^' . join('|',@grouppats) . '$'; #';
X
X$connection = &nnrpOpen($nntpserver);
X
X@active = &nnrpList($connection,"");
X
Xforeach (@active) {
X    ($group,$hi,$lo,$flags) = split(' ',$_,4);
X    next unless ($flags =~ /^[ynm]$/); # no aliased groups please
X    $groups{$group}++ if ($group =~ /$grouppat/o);
X}
X
Xforeach $group (keys %groups) {
X    ($first,$last,$num) = &nnrpGroup($connection,$group);
X    foreach $line (&nnrpXover($connection,$first,$last)) {
X	&checkForHit($line);
X    }
X}
X
Xforeach (@hits) {
X    print $_,"\n";
X}
END_OF_FILE
if test 1442 -ne `wc -c <'novgrep.pl'`; then
    echo shar: \"'novgrep.pl'\" unpacked with wrong size!
fi
chmod +x 'novgrep.pl'
# end of 'novgrep.pl'
fi
if test -f 'nnrpfunc.pl' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nnrpfunc.pl'\"
else
echo shar: Extracting \"'nnrpfunc.pl'\" \(3860 characters\)
sed "s/^X//" >'nnrpfunc.pl' <<'END_OF_FILE'
X# this is a library routine file.  it is not separately executable.
X
X# somewhat based on nntp.pl by ishii@hexard.co.jp and jik@gza.com
X
X# set $nnrpfunc'debug for debugging output.
X
Xrequire "sys/socket.ph";
X
Xpackage nnrpfunc;
X
X$fhsym="nnrpfunc000000";	# for generating filehandle names
X
X$sockaddr_t = "S n a4 x8";	# or so we hope.  should be c2ph'ed, really
Xchop($myhost = `hostname`);	# cache this for future reference
X
X# send command, read response code.  internal.
Xsub nnrpCommand {
X    local($filehandle,$command) = @_;
X    local($response);
X
X    print $filehandle $command,"\r\n"; # Internet line-ending convention CRLF
X    print STDERR ">> $filehandle >> $command\n" if $debug;
X    $response = <$filehandle>;
X    $response =~ s/\r$//;
X    print STDERR "<< $filehandle << $response" if $debug;
X    $response;			# implicit return
X}
X
X# open connection to server, return name of filehandle.  public.
Xsub main'nnrpOpen {		# '{
X    local($servername) = @_;
X    local($name,$aliases,$proto,$port,$type,$len,$thisaddr,$thataddr,
X	  $this,$that,$filehandle,$banner,$readermode,$bannercode,
X	  $readermodecode);
X
X    # set up all the socket gubbish.  you call this an API?
X    ($name,$aliases,$proto) = getprotobyname('tcp');
X    ($name,$aliases,$port) = getservbyname('nntp','tcp');
X    ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
X    ($name,$aliases,$type,$len,$thataddr) = gethostbyname($servername);
X    $this = pack($sockaddr_t, &main'AF_INET, 0, $thisaddr); #');
X    $that = pack($sockaddr_t, &main'AF_INET, $port, $thataddr); #');
X
X    # now that the rigmarole is done, connect to the server with more rigmarole
X    $filehandle = $fhsym++;
X    socket($filehandle, &main'PF_INET, &main'SOCK_STREAM, $proto) ||
X	die "socket failed";
X    bind($filehandle, $this) || die "bind failed";
X    connect($filehandle, $that) || die "connect failed";
X
X    # turn off stdio buffering so we can work effectively
X    local($savefh) = select($filehandle);
X    $| = 1;
X    select($savefh);
X
X    $banner = <$filehandle>;
X    $banner =~ s/\r$//;
X
X    print STDERR "<< $filehandle << $banner" if $debug;
X
X    die "Server $servername must not like you: $banner"
X	unless ($banner =~ /^20[01]/);
X
X    $readermode = &nnrpCommand($filehandle,"MODE READER");
X
X    die "MODE READER blew up in some annoying way: $readermode"
X	unless ($readermode =~ /^(20[01]|500)/);
X
X    ($bannercode) = ($banner =~ /^(\d\d\d)/);
X
X    $can_post{$filehandle} = ($bannercode eq "200");
X
X    $filehandle;		# implicit return
X}
X
Xsub main'nnrpQuit {		# '{
X    local($filehandle) = @_;
X
X    &nnrpCommand($filehandle,"QUIT"); # implicit return
X}
X
X# for reading in a bunch of lines, each ended by CRNL, terminating in a line
X# with a lone dot.  returns an array of NL-terminated strings.  does not
X# return the lone dot.  (Also handles NNTP dot-doubling.)
Xsub nnrpGetLongResponse {
X    local($filehandle) = @_;
X    local(@retval);
X
X    while(<$filehandle>) {
X	s/\r$//;		# clean off CR
X	print "<< $filehandle << $_" if $debug;
X	s/^\.//;		# take out first dot if any
X	last if /^$/;		# if it was "." then done
X	push(@retval,$_);	# if not, keep it
X    }
X    @retval;			# implicit return
X}
X
Xsub main'nnrpGroup {		# '{
X    local($filehandle,$group) = @_;
X    local($respcode,$numarts,$firstart,$lastart);
X
X    ($respcode,$numarts,$firstart,$lastart) =
X	split(/\s+/,&nnrpCommand($filehandle, "GROUP $group"));
X
X    return undef unless ($respcode =~ /^[23]/);
X    ($firstart,$lastart,$numarts); # implicit return
X}
X
Xsub main'nnrpXover {		#'{
X    local($filehandle,$first,$last) = @_;
X
X    $last = $first unless $last; # make sure there's a range
X
X    &nnrpCommand($filehandle,"XOVER $first-$last");
X    &nnrpGetLongResponse($filehandle);
X}
X
Xsub main'nnrpList {		#'{
X    local($filehandle,$listtype) = @_;
X
X    &nnrpCommand($filehandle,"LIST $listtype");
X    &nnrpGetLongResponse($filehandle);
X}
X
END_OF_FILE
if test 3860 -ne `wc -c <'nnrpfunc.pl'`; then
    echo shar: \"'nnrpfunc.pl'\" unpacked with wrong size!
fi
# end of 'nnrpfunc.pl'
fi
echo shar: End of shell archive.
exit 0
-- 
Christopher Davis * <ckd@kei.com> * (was <ckd@eff.org>) * MIME * PGP * [CKD1]
  "It's 106 ms to Chicago, we've got a full disk of GIFs, half a meg of
     hypertext, it's dark, and we're wearing sunglasses."  "Click it."
      - Looking for: _The Big U_, by Neal Stephenson (out of print) -
Re: Wanted: News searching utility
#11191
Author: James Stansell
Date: Fri, 02 Sep 1994 14:37
62 lines
3517 bytes
In article <1994Aug29.214842.3996@midway.uchicago.edu>,
Greg Kuperberg <gk00@midway.uchicago.edu> wrote:
>I am interesting a news searching utility, preferably one that does
>assume that you want to read much news or mark anything as read.
>Here are some typical searches that I might want to do:
[...]
>In each case, I don't want to mark these articles as read or unread,
>I don't want all articles BUT these marked as read, and I'm not even
>sure I even want the groups in my .newsrc.  In principle, these
>searches are reasonably fast with a threaded NNTP server, using
>XHDR commands and some computation.  I'm thinking of writing a PERL
>script to do the job.  I'd like to know there already is such an
>animal.

You might be interested in newscan by John McGowan - the README from
version 1.41 follows (this version was posted in alt.sources in February):

               newscan - a Perl Network News scanner
                         by John F. McGowan

***********************************************************************

COPYRIGHT NOTICE:

       This note is Copyright (C) 1993 by John F. McGowan.  Permission to
reproduce and distribute is granted however.  The README note may be
added to at the end after END OF ORIGINAL README.


Description:

       newscan is an attempt to solve the information overload problem
in the Network News groups by scanning news groups for articles that contain
matches to regular expressions.  newscan can also veto groups that contain
matches to regular expressions.

       newscan is written in Larry Wall's Perl (Practical Extraction and
Report Language).  Perl is described in Programming Perl by Larry Wall and
Randal L. Schwartz.  It is available for virtually all Unix systems.  It is
a public domain software package.

       newscan contains Perl comments, a short help message generated by
entering % newscan -h, and an embedded manpage following the convention
described in Programming Perl.

       newscan's author is John McGowan who can be reached at either
jfm@jupiter.slac.stanford.edu or jfm@btr.com.  Please send comments and
bug reports to the author.


STANDARD DISCLAIMER:

       newscan is distributed as is.  There is no warranty express or
implied that it will work correctly, do what you want, or anything else.
Use at your own risk.


------------------------>END OF ORIGINAL README<-----------------------

-- 
James Stansell                     Internet: james_stansell@wiltel.com
**** Linux -- the FREE 32-bit POSIX OS for your 386-compatible PC ****
Re: Wanted: News searching utility
#11322
Author: Nancy McGough
Date: Sat, 10 Sep 1994 01:13
60 lines
3347 bytes
If nn is available at your site you can use it with some of its
command line arguments to do this.  Suggested solutions are
embedded below.

gk00@quads.uchicago.edu (Greg Kuperberg) writes:
>1) Someone dumped an egg in my gas tank.  I haven't read rec.autos.*
>for ages and I don't plan to stay subscribed, but I would like to search
>for all articles in these groups with "egg" in the subject line.

nn -mxXs"egg" rec.autos.all


>2) I hear that Joe Schmoe is a hip poster in certain groups, so I
>would like a list of all available articles that he's posted in groups
>with the word "research" in them.

nn -mxXn"Joe Schmoe" .research.all

Unfortuntely the ``.name'' notation is not supported in nn 6.4.18 (does 
anyone know if it's supported in the later versions of nn?).  You could
create the newsgroup list by running ``nngrep -a research'' and then
do the search with this:

nn -mxXn"Joe Schmoe" alt.education.bangkok.research alt.education.research comp.compression.research comp.graphics.research comp.os.research comp.research.japan geometry.research sci.astro.research sci.econ.research sci.math.research sci.op-research sci.physics.research sci.psychology.research sci.research sci.research.careers sci.research.postdoc uk.org.starlink.research


Note that the name after -n needs to match the user's full name and not 
his email address.

>3) There's a new curve-fitting feature in Mathematica, and I would
>like a list of all articles posted to sci.math.symbolic with "wri"
>in the From line and "fit" in the Subject line.

Unfortunately the -s and -n flags cannot be used together so you'd
have to do this:

nn -mxXs"fit" sci.math.symbolic

And then from within nn search on the From line (using Gn).


>In each case, I don't want to mark these articles as read or unread,
>I don't want all articles BUT these marked as read, and I'm not even
>sure I even want the groups in my .newsrc.  In principle, these
>searches are reasonably fast with a threaded NNTP server, using
>XHDR commands and some computation.  I'm thinking of writing a PERL
>script to do the job.  I'd like to know there already is such an
>animal.

nn won't mark anything read or unread when you do this type of searching.
It's fast because it uses nn's name and subject databases.

Hope this helps,
Nancy

--

 **  **   Nancy McGough            |  "No one suspects the
*  **  *  Infinite Ink             |   days to be gods."      
 **  **   ftp://ftp.ii.com/pub/ii  |                     -Emerson    
nn doesn't get the Seal (was Re: Wanted: News searching utility)
#11439
Author: Russell Schulz
Date: Sat, 17 Sep 1994 08:33
14 lines
1459 bytes
why does so much software helpfully delete multiple spaces in Subject:
lines?  not just while displaying, but while posting?

this thread went from

- Subject: Wanted:  News searching utility

to

- Subject: Re: Wanted: News searching utility

why?  I assume this was posted with nn.
-- 
Russell Schulz  russell@alpha3.ersys.edmonton.ab.ca  ersys!rschulz  Shad 86c
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads