CIS 18B ASSIGNMENT 5

AWK


1. Use an awk command to create an output file from the input file. The input file contains one word in each line. The output file must contain only words that are equal in length to the longest word. You must use an awk command. The input file is called lab5_1_in. The output file is called lab5_1_out.


Lab5_1_in

AAAAAAA

BBBBBBBBB

CCCCCC

ddddddddd

XXXXXXXXX

EEEEE








2. Use an awk command to create an output file from two input files. The input files contain the city name and the average of high and low temperatures for the month of January. The first file is for 1990 and the second input file is for 1991. Each record in the output file must contain the name of the city , the average of temperatures for each year, and the change in the average from 1990 to 1991. For example, the line for city AAA should be:

AAA 27.5 26.5 -1


You must use an awk command. The input files are called lab5_2_in_1 and lab5_2_in_2. The output file is called lab5_2_out.


Lab5_2_in_1

AAA 35 20

BBB 40 25

CCC 41 26

DDD 50 30

EEE 49 42

FFF 28 18


Lab5_2_in_2

CCC 40 26

DDD 51 30

AAA 33 20

EEE 51 41

FFF 26 19

BBB 41 23




3. Use an awk command to create an output file from the input file. The input file contains a file of basketball scores. Each record is two lines followed by a blank line. Each team name can be more than one word. The winning team in each record is the top line of the record. The output file must contain the average score of winners, average difference between winners and losers, and the name and the score of the team with the highest score. You must use an awk command. The input file is called lab5_3_in. The output file is called lab5_3_out.


Lab5_3_in

Red Box 125

Cab 76


Rue The Day 145

Sew Tat 45


UFO Via 70

Pin Qui 45


You 89

XRX 67


Vat 89

Non de Max 67


















Non de Max Janes 67