Plan 9 from Bell Labs’s /usr/web/sources/contrib/someone/root/rc/bin/411

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
p='thompson k,'
f=/lib/411/d?

switch($#*){
case 1
	switch($1){
	case ?[0-9][0-9][0-9][0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/.(...)(....)/\1-\2/'}

	case ?[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/.(...)-(....)/\1-\2/'}

	case [0-9][0-9][0-9][0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/(...)(....)/\1-\2-908/'}

	case [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/(...)-(....)/\1-\2-908/'}

	case [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/(...)(...)(....)/\2-\3-\1/'}

	case [0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]
		f=/lib/411/i?
		p=`{echo $1|sed 's/(...)-(...)-(....)/\2-\3-\1/'}

	case *
		f=/lib/411/d?
		p=$1
	}

case 2
	f=/lib/411/d?
	p=$2 ^ ' ' ^ $1

case 3
	f=/lib/411/d?
	p=$3 ^ ' ' ^ $1 ^ ' ' ^ $2

case *
	echo usage: 411 908-555-1212
	echo '	  ' 411 '''finucane j'''
	exit
}

{
	for(i in $f)
		look $p $i | sed 's/([0-9][0-9][0-9]-[0-9][0-9][0-9][0-9])-([0-9][0-9][0-9])/\2-\1/'
} | sort

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.