home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / dcom / telecom / 12076 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  2.3 KB

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