kemp@noscvax.UUCP (Stephen P. Kemp) (05/21/84)
<a non-blank line>
Here's an attempt to make the cbosgd maps manipulable. Any comments?
Steve Kemp
Computer Sciences Corp.
Naval Ocean Systems Center
San Diego, CA
kemp@nosc
-or-
...ucbvax!sdcsvax!noscvax!kemp
# Script name: whencer
# Usage: % whencer
# Version: 840425 for csh under 4.2bsd
# Author: Steve Kemp <kemp@nosc> ...sdcsvax!noscvax!kemp (619) 225-8401
#
# PURPOSE:
# Creates the whence database file by processing the contents of
# $mapdir (which is created by cbosgd!map's shell scripts).
#
# THIS SCRIPT IS USED:
# After cbosgd!map's shell scripts have been run and stored into $mapdir,
# and before 'whence' is invoked...
#
# THIS SCRIPT PERFORMS THE FOLLOWING FUNCTIONS:
# 0) pushd to library of maps ($mapdir)
# 1) extract target lines from files named foo.map (e.g. usa.nj etc.)
# 2) a) prefix foo.map:Name: lines with a tilde (~)
# b) strip filenames out of non-Name: lines
# c) appending a : to last line component
# 3) remove all linefeeds,
# 4) change all ~ to linefeeds (with step 2a above)
# 5) store into temp file
# 6) close temp file by appending a blank line (for sort's sake)
# 7) return to user directory
# 8) cast out lines with no Organization
# 9) sort temp file, casting out duplicates and listing to storage file.
# 10) housekeep temp file
#
# START OF SCRIPT 'whencer'
set mapdir = /usr/lib/news/map
set whencedir = ~kemp/net
pushd $mapdir
egrep '^Organization:|^Phone:|^Contact|^Name:|^Postal|^Electronic' *.* \
| sed -e '/:Name:/s/^/~ --/' \
-e '/:Organization:/s#[^[:]*##' \
-e '/:Phone:/s#[^[:]*##' \
-e '/:Contact:/s#[^[:]*##' \
-e '/:Postal/s#[^[:]*##' \
-e '/:Electronic/s#[^[:]*##' \
-e '/:Electronic/s/$/:/' \
| tr -d '\012' \
| tr -s '\~' '\012' \
> /tmp/$$
echo " " >> /tmp/$$
popd
cat /tmp/$$ \
| sed -e '/Organization::/d' \
| sort -u \
> $whencedir/whencemap
/bin/rm /tmp/$$
# END OF SCRIPT 'whencer'
---------------------------------
# Script name: whence
# Usage: % whence string -or- % whence "string string"
# Version: 840425 for csh under 4.2bsd
# Author: Steve Kemp <kemp@nosc> ...sdcsvax!noscvax!kemp (619) 225-8401
#
# PURPOSE:
# Queries data base created by whencer for a specified string and returns
# a formatted list of sites associated with the target string.
#
# THIS SCRIPT IS USED:
# On demand after whencer has run (for this month)
#
# THIS SCRIPT PERFORMS THE FOLLOWING FUNCTIONS:
# 1) Defines where the whence database file resides.
# 2) Ignoring case, extracts lines from the whence database
# 3) Translates colons (:) into newlines for display
# 4) NOTE: omitting the tr step can be useful if you want to do further
# processing, since each site's info exists on exactly one line.
#
# START OF SCRIPT 'whence'
set whencedir = ~kemp/net
grep -i "$argv[1]" $whencedir/whencemap \
| tr -s '\:' '\012'
# END OF SCRIPT 'whence'
---------------------------------
E X A M P L E S
% whence korea
--asia.rok
Name
kaist
Organization
Korean Advanced Institute of Science and Technology,
Contact
Prof. Kilnam Chon, Yoon W. Kim
Phone
+82 2 966 1931 ext. 3744, 4714
Postal-Address
P.O. Box 150, Cheongryang, Seoul, Republic of Korea
Electronic-Address
kaist!yoonkim
News
hplabs dacom ketri kiet snucom
Mail
hplabs dacom ketri kiet snucom
% whence "name: cbosgd"
--usa.oh
Name
cbosgd
Organization
AT&T Bell Laboratories, Operating Systems Group
Contact
Mark Horton
Phone
(614) 860-4276
Postal-Address
Rm. 2C-249, 6200 E. Broad St., Columbus, OH 43213
Electronic-Address
cbosg!cbosgd!mark
News
ihnp4 mhuxl cbnscs osu-dbs cbscc qusavx cbdkc1 cbuxc cbrmc
Mail
neoucom psuvax atlas