Re: I Need Help...



On Wed, Mar 22, 2000 at 10:48:41AM -0800, eeyem@u.washington.edu wrote:
> 
> Where is .id ?

If you're using Debian with the doc-iana package installed or
otherwise have the file /usr/doc/doc-iana/assignments/country-codes.gz,
you may find the attached script handy at times like these :-).

miket

#! /bin/sh
#
# country code table grep
#

if [ -z "$1" ]; then
	echo "usage: country <code> or country <name>"
	exit 1
fi

CODE=`echo $1 | tr a-z A-Z`
FILE=/usr/doc/doc-iana/assignments/country-codes.gz

if [ `expr length $CODE` \< 3 ]; then
	zcat $FILE | \
	grep "[[:space:]]\+$CODE[[:space:]]\+[[:upper:]]\{3\}[[:space:]]\+[0-9]\{3\}$"
	if [ $? ]; then exit; fi
fi

if [ `expr length $CODE` \< 4 ]; then
	zcat $FILE | \
	grep "[[:upper:]]\{2\}[[:space:]]\+$CODE[[:space:]]\+[0-9]\{3\}$"
	if [ $? ]; then exit; fi
fi

zgrep $CODE $FILE



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]