[net.sources] incorporating net.news.map into path databases

oscar@utcsrgv.UUCP (Oscar M. Nierstrasz) (12/23/83)

#	I included an ed script called 'edmap' with the
#	path program a few articles ago.  The following
#	awk script should work much better.  It will
#	extract mail and news connections in net.news.map
#	and produce a graphfile for use by the path program.
echo MAPINFO
sed 's/^	//' > MAPINFO << 'Rosebud'
	The file mkgf replaces edmap.  It can be used to convert USENET maps in
	net.news.map to adjaceny lists or edge lists.  Use the shell script
	maps to find out which articles contain USENET maps.  Then run mkgf in
	a /tmp directory containing map.awk, ae.awk and ea.awk.  It produces
	.gf and .ef files containing adjacency lists and edge lists,
	respectively.  These may be merged with your existing graphfile in the
	usual way (place ef in net/map/more and run "make pathfile").
Rosebud
echo maps
sed 's/^	//' > maps << 'Rosebud'
	:	maps
	#	Lists subject headings of net.news.map articles.
	#	Used to identify latest USENET maps.
	cd /usr/spool/news/net/news/map
	for i in *
	do
		head $i | sed "s/^/$i: /" | fgrep Subject
	done
Rosebud
echo mkgf
sed 's/^	//' > mkgf << 'Rosebud'
	:	mkgf article ...
	#	Converts USENET maps to adjacency lists.
	#	The arguments are net.news.map articles containing
	#	USENET maps.  Use 'maps' to find these.
	#	Warning: there may be junk left undetected by map.awk.
	#	Check the *.gf files for leftover garbage.
	#	The *.gf files are graph files of adjacency lists
	#	and the *.ef files are edge files.
	#	The awk files map.awk, ae.awk and ea.awk must be present.
	map=/usr/spool/news/net/news/map
	for i
	do
		awk -f map.awk $map/$i > $i.gf
		echo $i.gf
		awk -f ae.awk $i.gf | sort -u > $i.ef
		echo $i.ef
	done
	sort -mu *.ef > ef
	echo ef
	awk -ea.awk ef > gf
	echo gf
Rosebud
echo map.awk
sed 's/^	//' > map.awk << 'Rosebud'
	/^Name:/ { printf "%s ", $2 }
	/^News:/,/^$|^Comments:|^!Funky!Stuff!/ {
		if (NF > 0) {
			if ($1 ~ /^Comments:|^!Funky!Stuff!/)
				print "}"
			else {
				if ($1 ~ /^News:/) {
					$1 = "{"
					print $0
					}
				else if ($1 ~ /^Mail:/) {
					$1 = ""
					if (NF > 1)
						print $0
					}
				else	print $0
				}
			}
		else	print "}"
		}
Rosebud
-- 

# UUCP:	{ allegra cornell decvax decwrl floyd ihnp4 linus
# 	  sask ubc-vision utzoo uw-beaver watmath } !utcsrgv!oscar