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

Write an awk script called facts that a.Prints full names and phone numbers for

ID: 3891148 • Letter: W

Question

Write an awk script called facts that

a.Prints full names and phone numbers for the Savages.

b.Prints Chet's contributions.

c.Prints all those who contributed $250 the first month.

Data:

Mike Harrington:(510) 584-1278:250:100:175
Christian Dobbins:(408) 538-2358:155:90:201
Susan Dalsass:(206) 654-6279:250:60:50
Archie McNichol:(206) 548-1348:250:100:175
Jody Savage:(206) 548-1278:15:188:150
Guy Quigley:(916) 343-6410:250:100:175
Dan Savage:(406) 298-7744:450:300:275
Nancy McNeil:(206) 548-1278:250:80:75
John Goldenrod:(916) 348-4278:250:100:175
Chet Main:(510) 548-5258:50:95:135
Tom Savage:(408) 926-3456:250:168:200
Elizabeth Stachelin:(916) 440-1763:175:75:300

My script:

BEGIN { FS=":" }

{

/Savage/{print $1, $2}

}

BEGIN { FS=":" }

{

/Chet/{print $3, $4, $5}

}

BEGIN { FS=":" }

{

if ($3 > 250)

print $0

}

For a and b, the results prints fine but not when I search people.

I'm getting syntax errors from a and b on the {print ....} syntax error on the parenthesis

Explanation / Answer

for b. you have to replace /Chet/{print $3, $4, $5} with if(/Chet/){print $3, $4, $5).

for a. just print $1, $2 works fine.

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