[net.sources] newsp - news article path names

romain@pyrnj.UUCP (Romain Kang) (04/26/86)

There's probably a better way to do this, but...

I recently started examining news article paths between my machine and
others to figure out what routes they were taking to get to my site.
There wasn't any handy way to get all the pathnames once I grep'd over
article IDs out of the history file, so I made this up.  I tend to think
of this as a tool for finding articles by site, but you could search
for other patterns in the history file.

Thus
	$ grep "^Path: " `newsp @princeton` | sed 's/[^!]//g'
will print a line of !'s for each article from princeton, each !
representing a hop in the netnews system,
	$ less `newsp lll-crg.ARpA`
will allow you to view every current article that has come out of
that site, and
	$ less `newsp "net\.unix-wizards/"`
is a braindamaged way to read current articles posted to net.unix-wizards.

My system runs 2.10.3, so I don't know whether it will works with
other versions.

#! /bin/sh
#   A quickie to find pathnames of articles from the history file matching
#   egrep patterns (from command args).
#
#   The sed commands:
#	/\t$/d
#		get rid of lines ending with tab (i.e., expired articles)
#	s/.*[ \t]\(.*\) $/\1/
#		get last newsgroup and local number ("net.unix-wizards/728")
#	s/\./\//g
#		translate dots to slashes:
#		net.unix-wizards/728 -> net/unix-wizards/728
#	s;^;$SPOOLDIR/;p
#		prepend "/usr/spool/news/"
#		net/unix-wizards/728 -> /usr/spool/news/net/unix-wizards/728
PATH=/bin:/usr/bin
LIBDIR=/usr/lib/news
SPOOLDIR=/usr/spool/news
egrep $* $LIBDIR/history |
    sed -n -e '/	$/d' -e 's/.*[ 	]\(.*\) $/\1/' \
	-e 's/\./\//g' -e "s;^;$SPOOLDIR/;p"
-- 
Romain Kang, Pyramid Technology Corporation

US Mail:	10 Woodbridge Center Drive, Woodbridge, NJ  07095
Ma Bell:	(201) 750-2626
UUCPnet:	{allegra,cmcl2,pyramid,topaz}!pyrnj!romain

"When in trouble, document..."