🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #14464

Re: kill files & regular expressions

#14464
From: Peter Kappesser
Date: Tue, 10 Jan 1995 11:35
63 lines
3625 bytes
Recently in news.software.readers, dwomack@runner.utsa.edu (Dave) wrote:

>I'm trying to filter my news a bit more thoroughly, and would like to kill
>any article cross-posted to more than three groups. I've tried:
>
>/^Newsgroups: *.*,*.*,*.*,*.*,/h:j
>
>and it deletes everything with more than one group...including the 'twos'
>and 'threes'.  I'm using rn on a Unix system...any ideas or suggestions?

Argh, I remember the feeling when learning about regular expressions ... so
tough to get them to do what you want, if you don't already know! But once
you realize their sheer power and elegance, you feel as though whoever
invented them should get the Nobel Prize.

Anyway, what you want is:

/^Newsgroups: .*,.*,.*,/h:j

The * in a regular expression works differently than it does in file name
expansion: it means to match on zero or more occurrances of the -previous
character-. The . is a special character that matches on -any- character.
So, the combination .* means to match on any sequence of characters, which
is what you may have been meaning with *.* in your example. [Since a *
followed a , in your example, the ,s matched on zero or more occurrances --
except for the , at the end. Your command reduces to /^Newsgroups: .*,/
which is why it junked articles with any commas in the Newsgroups line --
i.e. crossposted to two or more groups.]

Purists would want to further refine the regexp to match only on the
characters legal in a newsgroup name, but this accomplishes the desired
result.

Another suggestion which would run more efficiently, but only if you switch
to trn, would be

/,.*,.*,/HNewsgroups:j

The H modifier in trn lets you specify which header line to look at so you
don't have to put it in the pattern (but it's limited to the headers trn
recognizes). Some sites could run almost lightning-quick, if configured to
take advantage of the extensions in the overview file format, with

/:.*:.*:/HXref:j

This way, trn doesn't have to fetch the rest of the header to examine it,
saving a little time (or a lot: the header has to be fetched for *each*
article in the newsgroup) -- the Xref info for each article may be found in
the overview file trn gets when it enters the newsgroup. The Xref line is of
the form

Xref: server.name news.group.one:123 news.group.two:456

so the number of colons you find there is the number of groups crossposted.
I use a similar trick to automagically select any FAQs, with

/news.answers/HXref:+

in my global killfile. But I have to remember to disable this when visiting
news.answers...

--
pjkappes@mailbox.syr.edu (Peter Kappesser)
Technical Details
Message-ID: <3etre2$a8c@newstand.syr.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!dearn!blekul11!bliulg11!aix1.segi.ulg.ac.be!chaos.kulnet.kuleuven.ac.be! idefix.CS.kuleuven.ac.be!ub4b!EU.net!Germany.EU.net!howland.reston.ans.net!news.starnet.net!wupost!uhog.mit.edu!news.kei.com!travelers.mail.cornell.edu!newstand.syr.edu!forbin.syr.edu!pjkappes
References: <3esnno$ndm@ringer.cs.utsa.edu>

Show Full Headers
Complete Article Headers
Message-ID: <3etre2$a8c@newstand.syr.edu>
Subject: Re: kill files & regular expressions
Date: Tue, 10 Jan 1995 11:35:30 +0000
From: pjkappes@forbin.syr.edu (Peter Kappesser)
References: <3esnno$ndm@ringer.cs.utsa.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!dearn!blekul11!bliulg11!aix1.segi.ulg.ac.be!chaos.kulnet.kuleuven.ac.be! idefix.CS.kuleuven.ac.be!ub4b!EU.net!Germany.EU.net!howland.reston.ans.net!news.starnet.net!wupost!uhog.mit.edu!news.kei.com!travelers.mail.cornell.edu!newstand.syr.edu!forbin.syr.edu!pjkappes
Newsgroups: news.software.readers
Organization: Not Quite Syracuse University, Syracuse, NY
Lines: 63
Distribution: world
Reply-To: pjkappes@mailbox.syr.edu
NNTP-Posting-Host: forbin.syr.edu
Cc: dwomack@runner.utsa.edu