CSCI 344
awk Problems
Resources
Problems
Using only awk, write awk scripts to solve each of the following. Only call awk once (don't pipe awk to awk).
1. Print every line of a file. This will behave like cat utility.
2. Count the number of blank lines (lines with no characters or lines with one or more tabs and spaces) in a file.
3. Assuming that the input has the following format:
last name, first name, street address, city, zip code, phone number
Write an awk script that prints each record in the file in the following format:
first name: phone number
4. Assuming that each line of the input contains a name followed by four test grades:
Sam Smith, 98, 97, 99, 100
Sally Jones, 78, 84, 67, 81
Rodger Kelp, 98, 91, 89, 93
Write a script that prints each name followed by that students average
test score. At the end of the file print the average for the
entire class:
Sam Smith: 98.5
Sally Jones: 77.5
Rodger Kelp: 92.75
Class ave: 89.5833