home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!network.ucsd.edu!pacbell.com!lll-winken!telecom-request
- From: eggert@twinsun.com (Paul Eggert)
- Newsgroups: comp.dcom.telecom
- Subject: 714fix: A Conversion Program For 714/909 Area Code Split
- Message-ID: <telecom12.864.10@eecs.nwu.edu>
- Date: 21 Nov 92 21:20:28 GMT
- Sender: Telecom@eecs.nwu.edu
- Organization: Twin Sun, Inc
- Lines: 97
- Approved: Telecom@eecs.nwu.edu
- X-Submissions-To: telecom@eecs.nwu.edu
- X-Administrivia-To: telecom-request@eecs.nwu.edu
- X-Telecom-Digest: Volume 12, Issue 864, Message 10 of 15
-
- Here's '714fix', a Unix Bourne shell script that reads standard input
- and writes standard output, converting telephone numbers to adjust for
- the split of California's 714 and 909 area codes on 15 November 1992.
- You can apply this program to arbitrary text: it modifies only the
- affected telephone numbers.
-
- There is NO WARRANTY with this program. This program is derived from
- data supplied by GTE, and it probably contains errors. Use it at your
- own risk.
-
- #!/bin/sh
-
- # Read argument files (or standard input if none), and write standard output,
- # adjusting telephone numbers to account for the 714/909 area code split.
-
- # $Id: 714fix,v 1.1 1992/09/15 07:53:17 eggert Exp $
-
- # Please send corrections (with justifications) to eggert@twinsun.com.
-
- # The source is:
-
- # GTE CA 5706C phone bill insert
-
- # The following prefixs are duplicated in both 714 and 909 area codes,
- # so they are not included in the list below.
-
- # 555 long distance info
- # 561 reserved for future emergency use
- # 853 time
- # 950 long distance carrier access
- # 976 info providers
-
- # area codes
- from=714
- to=909
-
- # Compute the sed commands from the area codes and prefixes to be changed.
- sedsed='{
- s@#.*@@
- s@[ ]@@g
- /^$/d
- s@.*@s/\\([^0-9]\\)'$from'\\([-). ][-). ]*&[-. ]\\)/\\1'$to'\\2/g@
- }'
- sed_commands=`
- sed "$sedsed" <<'EOF'
-
- # prefixes in $from that should be moved to $to
- 24[2-7]
- 27[2-9]
- 30[1-47-9]
- 33[5-8]
- 34[13]
- 35[0-9]
- 36[09]
- 37[01]
- 38[1-46-9]
- 39[0-9]
- 42[0-8]
- 43[19]
- 46[0-9]
- 47[3578]
- 48[1-8]
- 58[45]
- 59[0-9]
- 60[3-57]
- 62[0-9]
- 65[2-9]
- 67[246-9]
- 68[1-9]
- 69[4-9]
- 710
- 73[4-7]
- 76[35-79]
- 78[0-57-9]
- 79[02-9]
- 82[02-59]
- 84[59]
- 86[0-24-9]
- 87[2-8]
- 88[0-9]
- 899
- 92[02-9]
- 93[013]
- 9[48][0-9]
-
- EOF
- `
-
- # Run the sed script.
- exec sed '
- /'$from'/{
- s/^/ /
- '"$sed_commands"'
- s/^ //
- }
- ' ${1+"$@"}
-