🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
10 messages
10 total messages Started by Jeffrey M. Vinocur Mon, 04 Dec 2000 00:00
Subset tool
#49259
Author: Jeffrey M. Vinocur
Date: Mon, 04 Dec 2000 00:00
21 lines
1651 bytes
I'm planning on adding a partial Usenet I feed to my server (INN 2.3) in 
the near future.  I've grabbed the active file and newsgroups from ISC 
and will select a subset of the groups and construct a wildmat pattern 
for my peers.  At some point in the future I may wish to change that 
pattern.

It seems to me that a handy tool would take a wildmat pattern and filter 
out the selected groups from the full-feed newsgroups file which are 
matched by the pattern.  Before I go figure out how to do this, does 
anyone already have such a thing.  

(I found `getlist` from INN, which sounds like a decent approximation, 
but it doesn't seem to be working -- regardless of whether I give it a 
host that should treat me as a peer or a reader, I get "Can't retrieve 
data, Permission denied".)

-- 
Jeffrey M. Vinocur
jeff@litech.org

Re: Subset tool
#49268
Author: Bill Cole
Date: Tue, 05 Dec 2000 00:00
16 lines
1284 bytes
In article <jeff-826F26.14363605122000@newsstand.cit.cornell.edu>,
"Jeffrey M. Vinocur" <jeff@litech.org> wrote:


>Sorry, are you interpreting "filter out" to mean "get rid of"?  That's 
>poor word choice on my part.  I mean "filter out and give to me so I can 
>make a smaller newsgroups file".

What am I missing that makes "grep <pattern> newsgroups" insufficient?

-- 
Bill Cole                                   
Record holder: lamest news server in the Freenix top 10k
MAPS worker bee geek, but definitely NOT speaking for MAPS

Re: Subset tool
#49269
Author: bill davidsen
Date: Tue, 05 Dec 2000 00:00
30 lines
2229 bytes
In article <jeff-A2896D.18035004122000@newsstand.cit.cornell.edu>,
Jeffrey M. Vinocur <jeff@litech.org> wrote:
| I'm planning on adding a partial Usenet I feed to my server (INN 2.3) in 
| the near future.  I've grabbed the active file and newsgroups from ISC 
| and will select a subset of the groups and construct a wildmat pattern 
| for my peers.  At some point in the future I may wish to change that 
| pattern.
| 
| It seems to me that a handy tool would take a wildmat pattern and filter 
| out the selected groups from the full-feed newsgroups file which are 
| matched by the pattern.  Before I go figure out how to do this, does 
| anyone already have such a thing.  

  Why write a tool when you can just select the groups which ARE
matched and delete them from the full list. Mind you, I'm not sure why
you want to do this...

| (I found `getlist` from INN, which sounds like a decent approximation, 
| but it doesn't seem to be working -- regardless of whether I give it a 
| host that should treat me as a peer or a reader, I get "Can't retrieve 
| data, Permission denied".)

-- 
  bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
The line from the immutable past to the desired future is useful to
justify continuing to tack into the wind, making a major change in
course, or coasting into safe harbor. It is not a map of where you are
going, just how to get where you want to go.

Re: Subset tool
#49272
Author: Jeffrey M. Vinocur
Date: Tue, 05 Dec 2000 00:00
21 lines
1685 bytes
In article <90jdrd$chge$1@newssvr06-en0.news.prodigy.com>, 
davidsen@tmr.com (bill davidsen) wrote:

:| It seems to me that a handy tool would take a wildmat pattern and filter 
:| out the selected groups from the full-feed newsgroups file which are 
:| matched by the pattern.  Before I go figure out how to do this, does 
:| anyone already have such a thing.  
:
:  Why write a tool when you can just select the groups which ARE
:matched and delete them from the full list. Mind you, I'm not sure why
:you want to do this...

Sorry, are you interpreting "filter out" to mean "get rid of"?  That's 
poor word choice on my part.  I mean "filter out and give to me so I can 
make a smaller newsgroups file".

-- 
Jeffrey M. Vinocur
jeff@litech.org

Re: Subset tool
#49290
Author: Eric Edwards
Date: Wed, 06 Dec 2000 00:00
22 lines
1798 bytes
On Wed, 06 Dec 2000 09:41:37 -0500, Bill Cole <bill@scconsult.com> wrote:
>In article <jeff-83F69E.01272906122000@newsstand.cit.cornell.edu>,
>"Jeffrey M. Vinocur" <jeff@litech.org> wrote:
>
>>In article <bill-0512001539590001@fireproof.scconsult.com>, 
>>bill@scconsult.com (Bill Cole) wrote:
>>
>>:What am I missing that makes "grep <pattern> newsgroups" insufficient?
>>
>>Err, grep doesn't do wildmat...
>
>Are your patterns that hard to translate?

I don't know about Bill's, but mine are.  More than 200 entries with
order dependencies.  Some things, I don't know how I would express in
regex even if I was willing to do it by hand.

-- 
Real courtesy requires human effort and understanding.  
Never let your machine or your habit send courtesy copies.

Re: Subset tool
#49292
Author: Bill Cole
Date: Wed, 06 Dec 2000 00:00
18 lines
1388 bytes
In article <jeff-83F69E.01272906122000@newsstand.cit.cornell.edu>,
"Jeffrey M. Vinocur" <jeff@litech.org> wrote:

>In article <bill-0512001539590001@fireproof.scconsult.com>, 
>bill@scconsult.com (Bill Cole) wrote:
>
>:What am I missing that makes "grep <pattern> newsgroups" insufficient?
>
>Err, grep doesn't do wildmat...

Are your patterns that hard to translate?

-- 
Bill Cole                                   
Record holder: lamest news server in the Freenix top 10k
MAPS worker bee geek, but definitely NOT speaking for MAPS

Re: Subset tool
#49294
Author: Russ Allbery
Date: Wed, 06 Dec 2000 00:00
14 lines
1266 bytes
Jeffrey M Vinocur <jeff@litech.org> writes:
> bill@scconsult.com (Bill Cole) wrote:

>> What am I missing that makes "grep <pattern> newsgroups" insufficient?

> Err, grep doesn't do wildmat...

A wildmat-using version of grep would actually be pretty easy to write and
would be generally useful.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Subset tool
#49300
Author: Jeffrey M. Vinocur
Date: Wed, 06 Dec 2000 00:00
26 lines
2143 bytes
In article <slrn92su60.5e1.ese002@spica.exile.org>, 
ese002@news9.exile.org (Eric Edwards) wrote:

:On Wed, 06 Dec 2000 09:41:37 -0500, Bill Cole <bill@scconsult.com> wrote:
:>In article <jeff-83F69E.01272906122000@newsstand.cit.cornell.edu>,
:>"Jeffrey M. Vinocur" <jeff@litech.org> wrote:
:>
:>>Err, grep doesn't do wildmat...
:>
:>Are your patterns that hard to translate?
:
:I don't know about Bill's, but mine are.  More than 200 entries with
:order dependencies.  Some things, I don't know how I would express in
:regex even if I was willing to do it by hand.

As are mine.  Keep in mind the goal is to maintain an eclectic subset of 
a usenet feed...the sort of stuff a bunch of geeks would want to read.  
So if somebody wants me to add alt.the.motherboard.i.just.bought.* and 
delete alt.the.old.motherboard.*, I'd like to generate a newsgroups file 
off of the new list without having to think about it.

-- 
Jeffrey M. Vinocur
jeff@litech.org

Re: Subset tool
#49304
Author: Jeffrey M. Vinocur
Date: Wed, 06 Dec 2000 06:27
11 lines
1429 bytes
In article <bill-0512001539590001@fireproof.scconsult.com>, 
bill@scconsult.com (Bill Cole) wrote:

:What am I missing that makes "grep <pattern> newsgroups" insufficient?

Err, grep doesn't do wildmat...

-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Subset tool
#49345
Author: Kai Henningsen
Date: Sat, 09 Dec 2000 17:29
82 lines
3275 bytes
rra@stanford.edu (Russ Allbery)  wrote on 06.12.00 in <ylbsupdqju.fsf@windlord.stanford.edu>:

> Jeffrey M Vinocur <jeff@litech.org> writes:
> > bill@scconsult.com (Bill Cole) wrote:
>
> >> What am I missing that makes "grep <pattern> newsgroups" insufficient?
>
> > Err, grep doesn't do wildmat...
>
> A wildmat-using version of grep would actually be pretty easy to write and
> would be generally useful.

Using the INN 1.x wildmat code (I suspect latter versions would work just  
as well), I wrote this rather crude tool some time ago. Consider it to be  
public domain; it's not large enough to bother. I'm using it mostly in  
Perl scripts associated with GUP.

Usage: wfilter <pattern file> <group list> <output group list>

#include "wildmat.c"
#include <assert.h>
#include <stdio.h>
#include <string.h>

FILE *pat, *lst, *out;
char buf[3000];
#define MAXPAT 100000
char *pats[MAXPAT];
int nxt, i, ok;

int main(int argc, char *argv[])
{
    assert(argc == 4);
    assert(pat = fopen(argv[1], "r"));
    while (!feof(pat)) {
	memset(buf, '\0', sizeof(buf));
	fgets(buf, sizeof(buf) - 1, pat);
	if (!*buf)
	    break;
	if (buf[strlen(buf) - 1] == '\n')
	    buf[strlen(buf) - 1] = '\0';
	if (!*buf)
	    break;
	pats[nxt++] = strdup(buf);
	assert(nxt < MAXPAT);
    }
    fclose(pat);
    assert(lst = fopen(argv[2], "r"));
    assert(out = fopen(argv[3], "w"));
    while (!feof(lst)) {
	memset(buf, '\0', sizeof(buf));
	fgets(buf, sizeof(buf) - 1, lst);
	if (!*buf)
	    break;
	if (buf[strlen(buf) - 1] == '\n')
	    buf[strlen(buf) - 1] = '\0';
	if (!*buf)
	    break;
	ok = 0;
	for (i = 0; i < nxt; i++) {
	    if (pats[i][0] == '!') {
		if (ok)
		    ok = !wildmat(buf, pats[i] + 1);
	    } else {
		if (!ok)
		    ok = wildmat(buf, pats[i]);
	    }
	}
	if (ok)
	    fprintf(out, "%s\n", buf);
    }
    fclose(lst);
    fclose(out);
    return 0;
}

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)
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