Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This needs to be done in UNIX. THe command using awk to Print the Last Name, Fir

ID: 3821308 • Letter: T

Question

This needs to be done in UNIX.

THe command using awk to Print the Last Name, First Name, Email Address, state and zip in a tabular format. Include the header identifying each field.

Consider the address book below:

$ cat addr

Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764

Natkin William, wnatkin@imap28.vcu.edu, 8044344528, Richmond, VA 22345

Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282

Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030

Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587

Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483

Adi SrikanthReddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854

Explanation / Answer

#!/bin/awk -f


BEGIN{
print "Last Name First Name Email Address State Zip"
}
{
split($0, arr, ", ")
split(arr[1], names, " ")
print names[2]" "names[1]" "arr[2]" "arr[4]" "arr[5]
}

save in a file named addr.awk

run chmod +x addr.awk

to run

./addr.awk addr

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote