Dan_Jacobson@ATT.COM (08/12/90)
#(areacode.(danj1) - part 1 of 1) #(I got to get this out to the masses before it gets too stale.) #Yes, this is Alex Dupuy's program with some enhancements. #!/bin/sh # This is areacode.danj1, a shell archive (shar 3.32) # made 08/12/1990 07:48 UTC by Dan_Jacobson@ATT.COM # Source directory /a119/danj1/tools/telecom/areacode/src # # existing files will NOT be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1453 -rw-r--r-- areacode.1 # 16315 -rwxr-xr-x areacode # if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= areacode.1 ============== if test X"$1" != X"-c" -a -f 'areacode.1'; then echo "File already exists: skipping 'areacode.1'" else echo "x - extracting areacode.1 (Text)" sed 's/^X//' << 'SHAR_EOF' > areacode.1 && X.TH AREACODE 1 "12 August 1990" X.SH NAME Xareacode \- North American and world areacode/place matcher X.SH SYNOPSIS X.B areacode X.I pattern X.RI [ pattern ...] X.SH DESCRIPTION XGiven \fI egrep(1) pattern\fPs, X.B areacode Xsearchs a table of North American telephone area codes and Xworld country codes for matches of place names or codes. X\fIpattern\fPs Xto match names with spaces in them should be quoted: e.g., "new york". XThis program is not case-sensitive reading its input. X XThe 2 and 3 letter ISO country codes are also output on international Xmatches. X X.SH EXAMPLES XTo find the area codes for New York, simply type: X.IP X$ \fIareacode "new york"\fP X.LP Xwhereas to find the region associated with area code 708, type: X.IP X$ \fIareacode 708\fP X.LP XGabon Africa? ... X.IP X$ \fI areacode Gabon\fP X.LP XNorth & South Carolina? ... X.IP X$ \fIareacode carolina\fP X X.SH AUTHORS X XOne-time-shot additional finishing touches by Dan_Jacobson@ATT.COM to Xthe version by Alexander Dupuy (dupuy@cs.columbia.edu), who did most Xof the work here, and issues occasional updates of his version to the XTelecom Digest (USENET newsgroup: comp.dcom.telecom) and its archives. XSee the areacode shell script itself for additional comments. [This Xis my (Dan Jacobson) first and probably final effort on this. Contact XAlex for his current version, or better yet, read Telecom Digest to Xfind out where its archive is and look there.] X X.\" I'm no nroff pro in what I added here -Dan J. SHAR_EOF $TOUCH -am 0812015890 areacode.1 && chmod 0644 areacode.1 || echo "restore of areacode.1 failed" set `wc -c areacode.1`;Wc_c=$1 if test "$Wc_c" != "1453"; then echo original size 1453, current size $Wc_c fi fi # ============= areacode ============== if test X"$1" != X"-c" -a -f 'areacode'; then echo "File already exists: skipping 'areacode'" else echo "x - extracting areacode (Text)" sed 's/^X//' << 'SHAR_EOF' > areacode && X: #areacode, version 1990-8-12-Dan_Jacobson@ATT.COM. Comments at bottom. Xcase $# in 0) X cat 1>&2 << EndOfUsage X $0: usage: X $ `basename $0` expression [ expression ... ] X where a "expression" consists of a place name or area/country code X (names with spaces in them should be quoted: e.g., "new york") X [this program is not case-sensitive reading its input] X The expressions are egrep(1) regular expressions. XEndOfUsage X exit 11 Xesac X Xexpression="$1"; shift Xfor argument in "$@" Xdo X expression="$expression|$argument" Xdone X X#Too bad, but still worked on my system: my egrep man page: "Egrep X#does not recognize ranges, such as [a-z], in character classes." Xexec egrep -i "$expression" << \EOF X011 [ International Access Code ] X200 [ Reserved - Service Access Code ] X201 Morristown, Newark, and Jersey City, (Northeast) New Jersey X202 Washington, District of Columbia X203 All parts of Connecticut X204 All parts of Manitoba, CANADA X205 All parts of Alabama X206 Seattle, Tacoma, and Vancouver, (Western) Washington X207 All parts of Maine X208 All parts of Idaho X209 Fresno and Stockton, (Central) California X210 * Unassigned * X211 [ Coin-operated Telephone Refunds ] X212 New York City (Manhattan and Bronx) New York X213 Los Angeles, California X214 Dallas, Texas X215 Allentown, Chester, and Philadelphia, (Southeast) Pennsylvania X216 Akron, Cleveland, Massillon, and Youngstown, (Northeast) Ohio X217 Springfield and Champaign-Urbana, (South Central) Illinois X218 Duluth, (Northern) Minnesota X219 Gary, Hammond, Fort Wayne, and South Bend, (Northern) Indiana X300 [ Reserved - Service Access Code ] X301 All parts of Maryland X302 All parts of Delaware X303 Boulder, Denver and Grand Junction, (Northern and Western) Colorado X304 All parts of West Virginia X305 Fort Lauderdale, Key West and Miami, (Southeast) Florida X306 All parts of Saskatchewan, CANADA X307 All parts of Wyoming X308 North Platte and Grand Island, (Western) Nebraska X309 Moline, Rock Island and Peoria, (West Central) Illinois X310 Parts of Los Angeles, California [214 until Spring 1992] X311 [ Reserved - Special Function ] X312 Chicago, Illinois X313 Detroit and Ann Arbor, (Eastern) Michigan X314 Saint Louis and Columbia, (Eastern) Missouri X315 Oswego, Syracuse and Utica, (North Central) New York X316 Dodge City and Wichita, (Southern) Kansas X317 Indianapolis and Kokomo, (Central) Indiana X318 Lake Charles and Shreveport, (Western) Louisiana X319 Dubuque, Cedar Rapids and Iowa City, (Eastern) Iowa X400 [ Reserved - Service Access Code ] X401 All parts of Rhode Island X402 Lincoln and Omaha, (Eastern) Nebraska X403 Alberta, Yukon Territory and (Western) Northwest Territories, CANADA X404 Atlanta and Rome, (Northern) Georgia X405 Oklahoma City, (Southern and Western) Oklahoma X406 All parts of Montana X407 Orlando, West Palm Beach, (Eastern) Florida X408 San Jose and Sunnyvale, (Central Costal) California X409 Galveston and Port Arthur, (Southeast) Texas X410 * Unassigned * X411 [ Local Directory Assistance ] X412 Pittsburgh and New Castle, (Western) Pennsylvania X413 Springfield and Pittsfield, (Western) Massachusetts X414 Green Bay, Milwaukee, and Racine, (Eastern) Wisconsin X415 Oakland and San Francisco, (Bay Area) California X416 Toronto, (South Central) Ontario, CANADA X417 Joplin and Springfield, (Southwest) Missouri X418 Quebec City, (Northeast) Quebec, CANADA X419 Toledo and Lima, (Northwest) Ohio X500 [ Reserved - Service Access Code ] X501 All parts of Arkansas X502 Louisville and Paducah, (Western) Kentucky X503 All parts of Oregon X504 Baton Rouge and New Orleans, (Eastern) Louisiana X505 All parts of New Mexico X506 All parts of New Brunswick, CANADA X507 Rochester, Austin and Winona, (Southern) Minnesota X508 Worcester, Framingham and New Bedford, (Eastern) Massachusetts X509 Spokane and Walla Walla, (Eastern) Washington X510 Oakland (East Bay Area), California [415 until Fall 1991] X511 [ Reserved - Special Function ] X512 Austin, Corpus Christi, and San Antonio, (Southern) Texas X513 Cincinnati and Dayton, (Southwest) Ohio X514 Montreal, (Southern) Quebec, CANADA X515 Des Moines and Fort Dodge, (Central) Iowa X516 Hempstead, (Long Island) New York X517 Lansing and Saginaw, (Central) Michigan X518 Albany and Schenectady, (Northeast) New York X519 London, (Southwest) Ontario, CANADA X600 [ Reserved - Service Access Code ] X601 All parts of Mississippi X602 All parts of Arizona X603 All parts of New Hampshire X604 All parts of British Columbia, CANADA X605 All parts of South Dakota X606 Ashland and Covington, (Eastern) Kentucky X607 Binghamton, Elmira and Ithaca, (South Central) New York X608 Beloit and Madison, (Southwest) Wisconsin X609 Atlantic City, Camden, and Trenton, (Southern) New Jersey X610 [Telex II (TWX) Service for CANADA] X611 [ Repair Service ] X612 Minneapolis and Saint Paul, (Central) Minnesota X613 Ottawa, (Southeast) Ontario, CANADA X614 Columbus and Zanesville, (Southeast) Ohio X615 Chattanooga and Nashville, (Eastern) Tennessee X616 Battle Creek and Grand Rapids, (Western) Michigan X617 Boston and surrounding area, (Eastern) Massachusetts X618 Alton and Centralia, (Southern) Illinois X619 San Diego and the Imperial Valley, California X700 Value Added Information Service Access Code (varies by LD carrier) X701 All parts of North Dakota X702 All parts of Nevada X703 Arlington and Roanoke, (Northern and Western) Virginia X704 Charlotte and Salisbury, (Western) North Carolina X705 North Bay, (Northern) Ontario, CANADA X706 [Formerly Tijuana, (Northwest) MEXICO equivalent to +52 6X XXX XXX] X707 Eureka, Napa, and Santa Rosa, (North Coastal) California X708 Aurora, Elgin, and Highland Park, (Northeast) Illinois X709 All parts of Newfoundland and Labrador, CANADA X710 * Unassigned * X711 [ Reserved - Special Function ] X712 Council Bluffs and Sioux City, (Western) Iowa X713 Houston and surrounding area, Texas X714 Orange County and Palm Springs, California X715 Eau Claire and Wausau, (Northern) Wisconsin X716 Buffalo, Niagara Falls, and Rochester, (Western) New York X717 Harrisburg, Pottsville and Scranton, (East Central) Pennsylvania X718 New York City (Queens, Brooklyn and Staten Island) New York X719 Colorado Springs and Pueblo, (Southeast) Colorado X800 "Toll-Free" Incoming WATS Service Access Code X801 All parts of Utah X802 All parts of Vermont X803 All parts of South Carolina X804 Charlottesville, Norfolk, and Richmond, (Southeast) Virginia X805 Bakersfield, Ventura, and Simi Valley, (South Central) California X806 Amarillo, (North Panhandle) Texas X807 Thunder Bay and Fort William, (Northwest) Ontario, CANADA X808 All parts of Hawaii X809 Bahamas, Bermuda, Puerto Rico, and the Virgin Islands X810 * Unassigned * X811 [ Reserved - Special Function ] X812 Bloomington, Evansville and Terre Haute, (Southern) Indiana X813 Fort Myers, St. Petersburg and Tampa, (Southwest) Florida X814 Altoona and Erie, (West Central) Pennsylvania X815 Freeport, Joliet and Rockford, (Northern) Illinois X816 Kansas City and Saint Joseph, (Northwest) Missouri X817 Fort Worth, Temple, and Waco, (North Central) Texas X818 Pasadena and San Fernando (area north of Los Angeles), California X819 Hull and Sherbrooke (Western) Quebec and (Eastern) N.W. Territories, CANADA X900 Mass Calling and Value Added Information Service Access Code X901 Memphis and Jackson, (Western) Tennesee X902 All parts of Prince Edward Island and Nova Scotia, CANADA X903 Texarkana and Paris, (Northeast) Texas [214 until Fall 1991] X904 Jacksonville and Pensacola, (Northern) Florida X905 [Formerly Mexico City, (Northern) MEXICO equivalent to +52 5 XXX XXXX] X906 Sault Ste. Marie and Marquette, (Upper North) Michigan X907 All parts of Alaska X908 Elizabeth and New Brunswick (Central) New Jersey [201 until Spring 1990] X909 [ Telenet Communications Data Network ] X910 * Unassigned * X911 [ Police/Fire Emergency Service ] X912 Macon and Savannah, (Southern) Georgia X913 Salina and Topeka, (Northern) Kansas X914 New Rochelle, White Plains and Poughkeepsie, (Southern) New York X915 Abilene, El Paso and Odessa, (Western) Texas X916 Sacramento and Davis, (Northern) California X917 * Unassigned * X918 Muskogee and Tulsa, (Northeast) Oklahoma X919 Greenville, Raleigh, and Winston Salem, (Eastern) North Carolina XAfghanistan AF AFG 93 XAlbania AL ALB 355 XAlgeria DZ DZA 21 3 XAmerican Samoa [U.S.] AS ASM 684 XAndorra AD AND 33 628 XAngola AO AGO 244 XAntarctica AQ ATA XAntigua and Barbuda AG ATG 1 809 XArgentina AR ARG 54 XAruba (ex Netherlands Antilles) ? ? 297 XAustralia AU AUS 61 XAustria AT AUT 43 XBahamas BS BHS 1 809 XBahrain BH BHR 973 XBangladesh BD BGD 880 XBarbados BB BRB 1 809 XBelgium BE BEL 32 XBelize (ex British Honduras) BZ BLZ 501 XBenin (Dahomey) BJ BEN 229 XBermuda BM BMU 1 809 XBhutan BT BTN ? XBolivia BO BOL 591 XBotswana BW BWA 267 XBouvet Island [Norway] BV BVT ? XBrazil BR BRA 55 XBritish Virgin Islands VG VGB 1 809 XBrunei Darusalaam BN BRN 673 XBulgaria BG BGR 359 XBurkina Faso (Upper Volta/Haute Volte) HV HVO 226 XBurundi BI BDI 257 XByelorussian SSR [USSR] BY BYS 7 XCameroon, United Republic of CM CMR 237 XCanada CA CAN 1 XCanton and Enderbury Islands [?] CT CTE ? XCape Verde CV CPV 238 XCayman Islands KY CYM 1 809 XCentral African Republic CF CAF 236 XChad TD TCD 235 XChile CL CHL 56 XChina, People's Republic of CN CHN 86 XChristmas Island [Australia] CX CXR 672 XCocos Islands [Australia] CC CCK 672 XColumbia CO COL 57 XComoros and Mayotte Island KM COM 269 XCongo CG COG 242 XCook Islands [N.Z.] CK COK 682 XCosta Rica CR CRI 506 XCote d'Ivoire (Ivory Coast) CI CIV 225 XCuba CU CUB 53 XCuba, Guantanamo Bay US Naval Base 53 99 XCyprus CY CYP 357 XCzechoslovakia CS CSK 42 XDenmark DK DMK 45 XDiego Garcia (Br. Indian Ocean Terr.) IO IOT 246 XDjibouti (ex Fr. Terr. Afars & Issars) DJ DJI 253 XDominica DM DMA 1 809 XDominican Republic DO DOM 1 809 XDronning Maud Land (Antarctica)[Norway] NQ ATN XEcuador EC ECU 593 XEgypt (United Arab Republic) EG EGY 20 XEl Salvador SV SLV 503 XEquatorial Guinea GQ GNQ 240 XEthiopia ET ETH 251 XFaeroe Islands [Denmark] FO FRO 298 XFalkland Islands [U.K.] FK FLK 500 XFiji FJ FJI 679 XFinland FI FIN 358 XFrance FR FRA 33 XFrench Guiana GF GUF 594 XFrench Polynesia (Tuamotu) PF PYF 689 XGabon GA GAB 241 XGambia, The GM GMB 220 XGerman Democratic Republic (East) DD DDR 37 XGermany, Federal Republic of (West) DE DEU 49 XGhana GH GHA 233 XGibraltar GI GIB 350 XGreece GR GRC 30 XGreenland [Denmark] GL GRL 299 XGrenada GD GRD 1 809 XGuadeloupe (French Antilles) GP GLP 590 XGuam [U.S.] GU GUM 671 XGuatemala GT GTM 502 XGuinea GN GIN 224 XGuinea-Bissau (ex Portuguese Guinea) GW GNB 245 XGuyana GY GUY 592 XHaiti HT HTI 509 XHeard and McDonald Islands [U.K.] HM HMD ? XHonduras HN HND 504 XHong Kong HK HKG 852 XHungary HU HUN 36 XIceland IS ISL 354 XIndia IN IND 91 XIndonesia ID IDN 62 XIran IR IRN 98 XIraq IQ IRQ 964 XIrish Republic (Eire) IE IRL 353 XIsrael IL ISR 972 XItaly IT ITA 39 XJamaica JM JAM 1 809 XJapan JP JPN 81 XJohnston Island [U.S.?] JT JTN ? XJordan JO JOR 962 XKampuchea, Democratic (Cambodia/Khmer) KH KHM 855 XKenya KE KEN 254 XKerguelen and Crozet Islands [Fr.] ? ? ? XKiribati Republic (Gilbert Islands) KI KIR 686 XKorea, Dem. People's Rep. of (North) KP PRK 850 XKorea, Republic of (South) KR KOR 82 XKuwait KW KWT 965 XLao People's Democratic Republic (Laos) LA LAO 856 XLebanon LB LBN 961 XLesotho LS LSO 266 XLiberia LR LBR 231 XLibyan Arab Jamahiriya LY LBY 21 8 XLiechtenstein LI LIE 41 75 XLuxembourg LU LUX 352 XMacao MO MAC 853 XMadagascar MG MDG 261 XMalawi MW MWI 265 XMalaysia MY MYS 60 XMaldives MV MDV 960 XMali ML MLI 223 XMalta MT MLT 356 XMarshall Islands [U.S.] PU PUS 692 XMartinique (French Antilles) MQ MTQ 596 XMauritania MR MRT 222 XMauritius MU MUS 230 XMexico MX MEX 52 XMicronesia, Federated States of PU PUS 691 XMidway Islands [U.S.] MI MID 1 808? XMonaco MC MCO 33 93 XMongolia MN MNG 976 XMontserrat MS MSR 1 809 XMorocco MA MAR 21 2 XMozambique MZ MOZ 258 XMyanmar (Burma) BU BUR 95 XNamibia NA NAM 264 XNauru NR NRU 674 XNepal NP NPL 977 XNetherlands NL NLD 31 XNetherlands Antilles AN ANT 599 XNeutral Zone (in Arabia?) NT NTZ XNew Caledonia [Fr.] NC NCL 687 XNew Zealand NZ NZL 64 XNicaragua NI NIC 505 XNiger NE NER 227 XNigeria NG NGA 234 XNiue NU NIU 683 XNorfolk Island (Australia) NF NFK 672 XNorthern Mariana Islands (Saipan)[U.S.] PU PUS 670 XNorway NO NOR 47 XOman (Muscat and Oman) OM OMN 968 XPacific Islands (Miscellaneous) PC PCI XPakistan PK PAK 92 XPalau ? ? 680 XPanama PA PAN 507 XPapua New Guinea PG PNG 675 XParaguay PY PRY 595 XPeru PE PER 51 XPhilippines PH PHL 63 XPitcairn Island [U.K.] PN PCN ? XPoland PL POL 48 XPortugal PT PRT 351 XPuerto Rico PR PRI 1 809 XQatar QA QAT 974 XReunion (France) RE REU 262 XRomania RO ROM 40 XRwandese Republic RW RWA 250 XSaint Helena & Ascension Island [U.K.] SH SHN 247 XSaint Kitts Nevis Anguilla KN KNA 1 809 XSaint Lucia LC LCA 1 809 XSaint Pierre et Miquelon (France) PM SPM 508 XSaint Vincent and the Grenadines VC VCT 1 809 XSan Marino SM SMR 39 541 XSao Tome e Principe ST STP 239 XSaudi Arabia SA SAU 966 XSenegal SN SEN 221 XSeychelles SC SYC 248 XSierra Leone SL SLE 232 XSingapore SG SGP 65 XSolomon Islands SB SLB 677 XSomalia SO SOM 252 XSouth Africa ZA ZAF 27 XSouth Georgia & Sandwich Islands [U.K.] ? ? ? XSouth Yemen, People's Dem. Rep. of YD YMD 969 XSpain ES ESP 34 XSri Lanka (Ceylon) LK LKA 94 XSudan SD SDN 249 XSuriname SR SUR 597 XSvalbard and Jan Mayen Islands [Norway] SJ SJM 47 XSwaziland SZ SWZ 268 XSweden SE SWE 46 XSwitzerland CH CHE 41 XSyrian Arab Republic SY SYR 963 XTaiwan (Republic of China) TW TWN 886 XTanzania, United Rep. of (w/Zanzibar) TZ TZA 255 XThailand TH THA 66 XTimor, East (ex Portuguese Timor) TP TMP 62 XTogolese Republic TG TGO 228 XTokelau (Southern Union Islands) [N.Z.] TK TKL 690 XTonga TO TON 676 XTrinidad and Tobago TT TTO 1 809 XTunisia TN TUN 21 6 XTurkey TR TUR 90 XTurks and Caicos Islands TC TCA ? XTuvalu (Ellice Islands) TV TUV 688 XUganda UG UGA 256 XUkrainian SSR [USSR] UA UKR 7 XUnion of Soviet Socialist Republics SU SUN 7 XUnited Arab Emirates (Trucial States) AE ARE 971 XUnited Kingdom GB GBR 44 XUnited States US USA 1 XUnited States Misc. Pacific Islands PU PUS XUnites States Virgin Islands VI VIR 1 809 XUruguay (East Republic of) UY URY 598 XVanuatu (New Hebrides) VU VUT 678 XVatican City State (Holy See) VA VAT 39 66982 XVenezuela VE VEN 58 XViet Nam VN VNM 84 XWake Island [U.S.] WK WAK ? XWallis and Futuna Islands [Fr.] WF WLF 681 XWestern Sahara (ex Spanish Sahara) EH ESH 21 2 XWestern Samoa WS WSM 685 XYemen Arab Republic (North) YE YEM 967 XYugoslavia YU YUG 38 XZaire (Congo) ZR ZAR 243 XZambia ZM ZMB 260 XZanzibar (obs: use Tanzania, 255 54) 259 XZimbabwe (ex Southern Rhodesia) ZW ZWE 263 X~Int'l Marine Satellite, Atlantic Ocean 871 X~Int'l Marine Satellite, Indian Ocean 873 X~Int'l Marine Satellite, Pacific Ocean 872 X~Reserved for national mobile purposes 878 X~Reserved for national mobile purposes 879 XEOF Xexit #if still going after exec, for some reason X X#This version of areacode is with one-time-shot finishing touches by X#Dan_Jacobson@ATT.COM. Data entry, idea, most of the work, etc. X#really by Alexander Dupuy (dupuy@cs.columbia.edu). For Alex's X#current version, and other programs like this, see USENET newsgroup X#comp.dcom.telecom (Telecom Digest) and its archives. Please don't X#send messages to me (Dan) saying this data is out of date---I just X#used Alex's [4/1990] data. I do have a makefile that converts Alex's X#(at least his early 1990) version to mine that will probably work for X#while, unless Alex changes his format. If interested, I'll e-mail X#that makefile to you. My version's advantages: more general searcher X#function, searches both North America & world data (yes, prejudiced X#towards North American users). I don't print the (confusing) ISO X#numeric country code next to the telephone country code though. This X#is a one time enhancement to Alex's program. I'm getting out of the X#areacode biz. I'm hoping that Alex might adopt some of these X#enhancements. -Dan Jacobson. SHAR_EOF $TOUCH -am 0812024890 areacode && chmod 0755 areacode || echo "restore of areacode failed" set `wc -c areacode`;Wc_c=$1 if test "$Wc_c" != "16315"; then echo original size 16315, current size $Wc_c fi fi exit 0