[comp.sources.wanted] quick address database wanted

dem@ihwpt.ATT.COM (David E. Martin) (10/18/88)

Does anyone have a quick (probably a couple of shell scripts)
phone and address database?  I'm sure I could write something
up, but I hate to duplicate the effort.

		David Martin
		AT&T Bell Laboratories
		dem@iexist.att.com

jpr@dasys1.UUCP (Jean-Pierre Radley) (10/20/88)

In article <2699@ihwpt.ATT.COM> dem@ihwpt.ATT.COM (David E. Martin) writes:
>Does anyone have a quick (probably a couple of shell scripts)
>phone and address database?  I'm sure I could write something
>up, but I hate to duplicate the effort.

I've called mine '411', which is what you use to dial information...

----cut----here----
: << 411
get phone #s from /pub/lib/411 & $HOME/lib/411, containing colon-separated
entries in format:
	'lastname:firstname:telephone#:otherinfo'
usage: 411  [key1 [key2 [...]]]
examples: '411 mike' gives all MIKEs, '411 mike 201' gives only MIKEs in NJ,
'411 home rad' gives only home numbers (if so coded), for RADleys, but also for
any bRADs, homes on paRADe avenue, etc.
Tso, Tse, and Tup are terminal seqences for Standout-start, Standout-end,
and Cursor-up. "terment" is usually called "tput" on other systems.
411

[ "$Tso" -a "$Tse" -a "$Tup" ] || {
	Tso=`terment so`; Tse=`terment se`; Tup=`terment up`; }
[ -f /pub/lib/411 ] && LIST="$LIST /pub/lib/411"
[ -f $HOME/lib/411 ] && LIST="$LIST $HOME/lib/411"
[ "$LIST" ] && echo "\t\tlooking in$LIST" ||
	{ echo "\t$Tso no telephone lists $Tse" && exit 1 ; }

while [ $1 ]
do
	KEY="${KEY+$KEY&&}/$1/"
	shift
done

awk "
BEGIN { FS= \":\" }
$KEY  { if (FOUND % 20 == 0 ) \
	printf \"      "$Tso"numero"$Tse"\t       "$Tso"first$Tse "$Tso"last"$Tse"\t\t\t\t"$Tso"...und so weiter$Tse\", \"\"
#	if (length(\$4)<33) printf \"%12s %15s %-18s %32s\",\$3,\$2,\$1,\$4
	if (length(\$4)+length(\$1)<51) \
		printf \"%80s$Tup%12s %15s %s\n\",\$4,\$3,\$2,\$1
	else printf \"%12s %15s %s\n%80s\",\$3,\$2,\$1\" >\",\"< \"\$4
	FOUND++ }
END   { if (FOUND == 0) print \"\t$Tso Sorry, unlisted number ... $Tse\" }
" $LIST
----cut----here----
-- 

Time is nature's way of				Jean-Pierre Radley
making sure that everything			jpr@dasys1.UUCP
doesn't happen all at once.			CIS: 76120,1341

dtynan@sultra.UUCP (Der Tynan) (10/21/88)

In article <7073@dasys1.UUCP>, jpr@dasys1.UUCP (Jean-Pierre Radley) writes:
> In article <2699@ihwpt.ATT.COM> dem@ihwpt.ATT.COM (David E. Martin) writes:
> >Does anyone have a quick (probably a couple of shell scripts)
> >phone and address database?  I'm sure I could write something
> >up, but I hate to duplicate the effort.
> 
> I've called mine '411', which is what you use to dial information...
> 
> ----cut----here----
	[Deleted for brevity]
> ----cut----here----
> -- 
> 
> Time is nature's way of				Jean-Pierre Radley
> making sure that everything			jpr@dasys1.UUCP
> doesn't happen all at once.			CIS: 76120,1341

Although the above probably works real well, I just use a CSH alias.  I guess
it could be done with the Korn shell too, but I don't have access to it...
This appears in my .cshrc;

alias phone 'grep -i \!$ /u/dtynan/.phonelist'

The file .phonelist has the format
Joe Isuzu		Isuzu Corporation, Japan	(408) 555-1212

If I type 'phone joe', I get what I want.  I can't take the original credit
for this, as far as I remember I ripped off the original idea from Bud
Carlson, when he was at Megatest...
						- Der
-- 
Reply:	dtynan@sultra.UUCP		(Der Tynan @ Tynan Computers)
	{mips,pyramid}!sultra!dtynan
	Cast a cold eye on life, on death.  Horseman, pass by...    [WBY]

jpr@dasys1.UUCP (Jean-Pierre Radley) (10/22/88)

In article <2587@sultra.UUCP> dtynan@sultra.UUCP (Der Tynan) writes:
>In article <7073@dasys1.UUCP>, jpr@dasys1.UUCP (Jean-Pierre Radley) writes:
>> In article <2699@ihwpt.ATT.COM> dem@ihwpt.ATT.COM (David E. Martin) writes:
>> >Does anyone have a quick (probably a couple of shell scripts)
>> >phone and address database?  I'm sure I could write something
>> >up, but I hate to duplicate the effort.
>> 
>> I've called mine '411', which is what you use to dial information...
>> ----cut----here----
>	[Deleted for brevity]
>> ----cut----here----
>Although the above probably works real well, I just use a CSH alias.  I guess
>it could be done with the Korn shell too, but I don't have access to it...
>This appears in my .cshrc;
>
>alias phone 'grep -i \!$ /u/dtynan/.phonelist'

And the alias I have in use is f11:
	alias f11 look \!* /pub/lib/411
which finds things very quickly. My /pub/lib/411 is sorted, last names
being first.

The grep alias would turn up every Joe in the list, which may or may not
be annoying, just as my f11 alias would turn up every family or business
named Smith.

But the 411 shell script, while certainly slower, allows me to ask

411 joe japan	# finds, inter alia, smith:joe:201-444-5555:speaks japanese
	or
411 smith ann	# finds, inter alia, leann smithson
	or
411 214- hop	# finds, inter alia, hopkins in dallas area, chop house at
		  214-56 178th road

As I keep 1700 numbers in this list, I like to be able to give two or
three keys to narrow the search.
-- 

Time is nature's way of				Jean-Pierre Radley
making sure that everything			jpr@dasys1.UUCP
doesn't happen all at once.			CIS: 76120,1341