Question

Build a phonebook utility that allows you to access and modify a list of names, addresses,...

Build a phonebook utility that allows you to access and modify a list of names, addresses, and telephone numbers. Your utility can be an awk script or a combination of unix scripting, awk, and other utilities.

Modifications possible must include but are not limited to:

          adding entries

          deleting entries

          listing the phonebook in alphabetical order

          finding specific entries

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Adding.sh

#phone book name

PHONEBOOK="phoneBook.txt"

#Assigns varaible for NAME and asking user to enter NAME

echo -n"Person's Name:"

read PerName

#Assigns varaible for ADDRESS and asking user to enter ADDRESS

echo -n"Person's Address:"

read PerAddress

#Assigns varaible for NAME and asking user to enter NAME

echo -n"Person's Number:"

read PerNumber

echo" enter values:"

echo -e"$PerName;$PerAddress;$PerNumber "

echo-n "y/n:"

read PerAnswer

if["PerAnswer=="y"]

then

#Writing VALUES to Phone BOOK

echo"$PerName;$PerAddress;$PerNumber>>PHONEBOOK

else

#Message FOR User

echo "$$PerName;$PerAddress;$PerNumber NOT Included to book

fi exit 0

listing.sh

#phone book name

PHONEBOOK="phoneBook.txt"

#NUMBER format before the data

echo"Line Number: Name; Address;phone number"

#Listing In alphabetical order

Sort PHONEBOOK.txt#Printing the PhoneBook with LINE numbera and less paused

n1--numb-separator=":    "$PHONEBOOK |less

finding.sh

#phone book name

PHONEBOOK="phoneBook.txt"

#Ask the USER to looking for

echo -n "Which PERSON you need to Find:"

read Perfind

#Printing HEADER before the Ans

grep -i $PerFind $PHONEBOOK

Deleting.sh

#phone book name

PHONEBOOK="phoneBook.txt"

#ASK user to delete a specific line

echo -n"Which LINE wants to delete"

read numb

#RENAME before DELETE

mv $PHONEBOOK myphoneBook.txt

#ADDING line_NUMBers and again deleting number

nl--numb-separator=":"myphoneBook.txt|grep -v $numb:|awk -F:'{print $2}'

PhoneBook.sh

#phone book name

PHONEBOOK="phoneBook.txt"

        exit=0

        while [ $exit -ne 1 ]

        do

            echo "What OPERATION do you want to Perform?"

echo -e "adding, listing, finding, deleting, exit:

"            read Fanswer

          if [ "$Fanswer" = "adding" ]

            then

                ./adding.sh

            elif [ "$Fanswer" = "listing" ]

            then

                ./listing.sh

            elif [ "$Fanswer" = "finding" ]

    then

       ./finding.sh

            elif [ "$Fanswer" = "deleting" ]

           then

                ./deleting.sh

            elif [ "$Fanswer" = "exit" ]

            then

              #EXIT val set to 1

                exit=1

            else

              #ALERT message

                echo " SORRY!I do not UNDERSTAND the command."

            fi

        done

        #Out from script

exit 0

Add a comment
Know the answer?
Add Answer to:
Build a phonebook utility that allows you to access and modify a list of names, addresses,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT