toddi@nsr.bioeng.washington.edu (Todd Inch) (05/29/90)
In article <8294@accuvax.nwu.edu> mailrus!uflorida!rm1!bapat@
uunet.uu.net (Bapat) want's to convert phone numbers with letters
to numeric, and has access to a Unix machine.
The following should do it. "tr" will translate a character in the
first string to a corresponding character in the second string.
BTW: tr "[a-z]" "[A-Z]" will convert lower-case strings to all
uppercase, which is irrelevant to this topic, but useful.
-------------------- cut here ---------------------------
:
# Shell script to convert alpha-containing phone number to all numeric.
# Put phone number on command line or wait for prompt.
#
if [ -z "$1" ]
then
echo "Phone number containing characters? \c"
read phnnum
else
phnnum="$1"
fi
if echo "$phnnum" | grep 'q\|Q\|z\|Z' > /dev/null
then
echo "There's no Q or Z on the phone dial."
exit 1
fi
echo "$phnnum" | tr "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVwWxXyY" \
"222222333333444444555555666666777777888888999999"
exit
-------------------- cut here ---------------------------
Todd Inch, System Manager, Global Technology, Mukilteo WA (206) 742-9111
UUCP: {smart-host}!gtisqr!toddi ARPA: gtisqr!toddi@beaver.cs.washington.edu
bapat@uunet.uu.net (Bapat) (05/31/90)
In article <8367@accuvax.nwu.edu>, gtisqr!toddi@nsr.bioeng. washington.edu (Todd Inch) writes: > [ Todd Inch posts a "tr"-based shellscript to do telephone keypad based > string->digits conversion ] As it turns out, after my query for a program for the above, it was pointed out to me that a pair of such programs (given string->digits and given digits->multiple possible strings) had JUST been posted to comp.sources.misc. Look for article v12i098 in that newsgroup for the programs "telenum" and "telewords". I had fun playing with them - and they'll be really useful for those wanting to ask for customized numbers. Subodh Bapat bapat@rm1.uu.net OR ...uunet!rm1!bapat MS E-204, P.O.Box 407044, Racal-Milgo, Ft Lauderdale, FL 33340 (305) 846-6068
kindred@cs.rochester.edu (David L Kindred (Dave)) (06/01/90)
In article <8367@accuvax.nwu.edu> gtisqr!toddi@nsr.bioeng. washington.edu (Todd Inch) writes: >echo "There's no Q or Z on the phone dial." Not strictly correct. Phones I have seen from '40s have the Z on the 0 (zero), and I have seen at least one phone that has the Q on the 0 also. I also recall seeing a modern phone with the Z on the 0, but don't remember where... Anyone have any particulars on who/when/why the Z and Q have been on/not on the Zero digit? EMail: kindred@telesci.UUCP (...!princeton!pyrnj!telesci!kindred) CI$: 72456,3226 (72456.3226@compuserve.com) Phone: +1 609 866 1000 x222 Snail: TeleSciences C O Systems, 351 New Albany Rd, Moorestown, NJ 08057-1177
ndallen@contact.uucp (Nigel Allen) (06/04/90)
David L Kindred (Dave) asks: >"Anyone have any particulars on who/when/why the Z and Q have been >on/not on the Zero digit?" Perhaps those letters disappeared because they were used in the channel designations for manual mobile telephone service. I don't have a complete list of those channel designations, but the Toronto telephone directory includes YL6-6709 and JS3-4438. Neither number includes Z or Q, so my theory may not be valid. A clarification: The channel number, I believe, is the first two characters, so the channel designation is always two letters.
johns@happy.uk.sun.com (John Slater) (06/04/90)
You may be interested to learn that the association of letters with telephone digits works slightly differently in the UK. First of all the assignment itself is different : 1 2 3 4 5 6 7 8 9 0 ABC DEF GHI JKL MN PRS TUV WXY OQ The main difference from the American method is that O is assigned to 0 rather then 6. Also Q is assigned to 0. We too have no Z. The other difference is that all this is ancient history! British Telecom (or the GPO as it was then) changed to "all-figure dialling" in the 1960's. Occasionally I see an old dial with the letters on as described above, but they are now very rare. The letters were used for STD codes (see below), and previously for dialling other exchanges within cities. For example, a number in the Mayfair district of London would be written as MAYfair 1234 - one of the Mayfair exchanges is still 629. I was interested to learn from the "coathanger" posting a while back that the same system was used in the US. Before "all-figure dialling", STD (subscriber trunk dialling, == long distance) codes were alphanumeric - e.g. Blackpool was 0BL3 (all UK STD codes start with zero, as in most parts of the world), whereas Blackburn was 0BL4. Today they are 0253 and 0254 respectively. The trailing digit was used simply to distinguish between codes for towns with similar initial letters, never as a third letter (except by chance). This scheme extends also to the original six large metropolitan districts which were allotted 3-digit STD codes and 7-digit numbers. Apart from London (01 until the recent split into 071/081), the codes are 021 *B*irmingham 031 *E*dinburgh 041 *G*lasgow 051 *L*iverpool 061 *M*anchester This was broken somewhat in the early 1980's by the introduction of 091 for the Newcastle/Sunderland/Durham area in the north-east. Dialling within this area is a real can of worms, but I'll save that for another posting. Because most of the STD codes were assigned back in the 1950's, it follows that, given an unknown STD code, one can make an intelligent guess as to where it is. E.g. I come from an area in the north-west with the code 0706. From the table, it can only be PO, RO or SO (ignoring Q!). In fact the town is called Rochdale. This system is not perfect, but it can help occasionally. It's amazing how much of this stuff comes back to you when you start thinking. All I was going to do was post the letter assignment table. If anybody is actually interested in this STD code stuff, let me know and I'll wrack my brains some more. And I'm just an amateur observer and user of telecom services, with a so-so memory, so there's no guarantee that this stuff is accurate. John Slater Sun Microsystems UK, Gatwick office
Mark Brader <msb@sq.com> (06/06/90)
I was waiting for someone else to point out this nonportability: > if echo "$phnnum" | grep 'q\|Q\|z\|Z' > /dev/null > then > echo "There's no Q or Z on the phone dial." > exit 1 > fi To work on all variants of UNIX, the grep pattern should be '[qQzZ]'. Mark Brader, SoftQuad Inc., Toronto, utzoo!sq!msb, msb@sq.com