Sponsored Content
Full Discussion: Telephone Format and Check
Top Forums Shell Programming and Scripting Telephone Format and Check Post 302996499 by mrn6430 on Wednesday 26th of April 2017 06:37:54 PM
Old 04-26-2017
Did not work. Updated code below

Code:
#!/bin/bash
read -p "Enter Telephone number to check: " telno
TnDash=`echo ${telno:0:3}-${telno:4:3}-${telno:8}`
if  [ ${telno} == ${telno#*[^0-9]} ] && [ ${#telno} -eq 10 ]; then
  TN=`echo ${telno:0:3}-${telno:3:3}-${telno:6}`
else
if [ ${telno} == ${TnDash} ]; then
  TN=$telno
else
  echo "Invalid number <$telno> entered. Entry must be numeric and 10 digits separated by dashes"
fi
fi
 PORTEDIN_NUM=$TN
echo "TN Entered = $PORTEDIN_NUM"

Here is the updated code. It seems to work fine. But is it a good way to check input telephone numbers and convert?

Output test #1 :

Code:
Enter Telephone number to check: 214-800-3000
Temp = 214-800-3000
TN Entered = 214-800-3000
Check current log for this TN?[y/n]

Output test #2:

Code:
Enter Telephone number to check: 214-800-3000
TN Entered = 214-800-3000


Last edited by mrn6430; 04-26-2017 at 09:33 PM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

telephone working in unix

sir, i came to know that telephone exchanges use unix for the working of telephones,that is when we take our hand set in telephone we can note a dial sound,for this telephone exchanges use unix. we are going to do project using unix,i want to know wheater we can able to connect... (1 Reply)
Discussion started by: radheesh
1 Replies

2. IP Networking

all about telephone in unix

hai to all, that i came to know all telephone exchanges use unix.i want to know wheather we can connect telephones uaeing unix,if it possible means how&and also i need about more information about "telephones in unix" ... (1 Reply)
Discussion started by: radheesh
1 Replies

3. UNIX for Dummies Questions & Answers

Got connected with Modem but cannot dial Telephone no. to connect to host

Hello There, I configure my Modem as follow. Step1. # admintool & Then from Browse --> Serial Port i select tta port and Edit --> Modify From that i select Template : Modem:Dial Out Baud Rate: 9600 Ok Step 2 # tip /dev/cua/a connected (1 Reply)
Discussion started by: abidmalik
1 Replies

4. Shell Programming and Scripting

Check the format of Date

Hi, I have a date field in my input file. I just want to check if its in the format "DD-MM-YYYY". Is there any command which can achieve this? Thanks and Regards, Abhishek (2 Replies)
Discussion started by: AAA
2 Replies

5. UNIX for Dummies Questions & Answers

File format check

How to check if file is in a given format? For instance: if file records are delimeted with "|" ( pipes) and have exactly 26 fields? File is pretty big (~3 mil reccords), so not sure if I have to check all records or just head/tail records or smth. Any ideas are much much more than... (11 Replies)
Discussion started by: Leo_NN
11 Replies

6. Shell Programming and Scripting

Check input date format?

how to check input date format. for example $input_date must be in format dd.mm.gg script is execute like this: bin/script1.sh 14.12.2009 script1.sh code: #!/bin/sh input_date=$1 CMD="/app/si/test/test.sh $input_date" echo "*****" $CMD (2 Replies)
Discussion started by: waso
2 Replies

7. Homework & Coursework Questions

Telephone book script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi, here is my other assignment for the week. Create a shell script for a telephone book application. ... (7 Replies)
Discussion started by: Jagst3r21
7 Replies

8. Shell Programming and Scripting

Check Date Format And Email Out

Hello All, I have a requirement where i need to get the EXTRACT_DATE from a file and check if the date is of valid format or not and then mail it if it is not valid. Appreciate if you can help me with this. I did the following so far. awk '{for(i=1;i++<=NF;)if($i~/^EXTRACT_DATE/) print $i}'... (11 Replies)
Discussion started by: Ariean
11 Replies
INSTALLSIEVE(1) 					      General Commands Manual						   INSTALLSIEVE(1)

 *

NAME
installsieve - user utility for managing sieve scripts SYNOPSIS
installsieve DESCRIPTION
installsieve is a utility that allows users to manage their sieve scripts kept on the server. OPTIONS
-v <name> View script with the given name. The script if retrieved sucessfully is output to standard output. -l List all of the scripts currently on the server. If one of the scripts is active a arrow is printed indicating that it is the active script. -p <port> Port to connect to. If left off this defaults to "sieve" as defined in /etc/services. -i <file> Install a file onto the server. If a script with the same name already exists on the server it is overwritten. Upon sucessfully putting the script on the server the script is set active. If <file> has the extension .script it is chopped when put on the server since sieve names may not contain a '.'. -a <name> Set <name> as the active script. The list of available names can be obtained from the '-l' option.. -d <name> Delete the sieve script on the server with <name>. -m <mechanism> Force installsieve to use <mechanism> for authentication. If not specified the strongest authentication mechanism is chosen. -g <name> Get the sieve script with <name> and save it to disk with a ".script" extension. If a file with that name already exists it is overwritten. -u <user> Userid/Authname to use for authentication; by default, the current user. CMU
Project Cyrus INSTALLSIEVE(1)
All times are GMT -4. The time now is 05:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy