Xref: utzoo comp.sources.wanted:5321 comp.misc:3865 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!cmcl2!phri!dasys1!jpr From: jpr@dasys1.UUCP (Jean-Pierre Radley) Newsgroups: comp.sources.wanted,comp.misc Subject: Re: quick address database wanted Keywords: database address name Message-ID: <7073@dasys1.UUCP> Date: 19 Oct 88 20:34:00 GMT References: <2699@ihwpt.ATT.COM> Reply-To: jpr@dasys1.UUCP (Jean-Pierre Radley) Organization: TANGENT Lines: 50 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