Write a bash script that uses awk to display only the names, phone number, state
ID: 655179 • Letter: W
Question
Write a bash script that uses awk to display only the names, phone number, state and zip in a tabular format of the address book below.
$ cat addressbook
Xiao Li, lxiao, lxiao@unc.edu, 6705462234, Jackson, NC 764
Natkin William, wnatkin, wnatkin@imap28.vcu.edu, 8044344528, Richmond, VA 22345
Elizi Moe, emoe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi SrikanthReddy, sadi1, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Explanation / Answer
#!/bin/bash
#file:d:/home/naman/tmp/phone.sh
#Description:Master script for phone book for program
Name of address book
BOOK="address-book.txt"
exit=0
while[$exit-ne1]
do
echo"What do you want to do"
echo -e"add,list,find,del,exist:"
read answer
if["$answer"="add"]
then
./add.sh
elif["$answer"="list"]
then
./list.sh
elif["$answer"="find"]
then
./find.sh
elif["$answer"="del"]
then
./del.sh
elis["$answer"="exit"]
then
exit=1
else
echo"I do not understand the coomand of the above language"
fi
done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.