Due August 8, Noon
Purpose:
To gain experience in writing shell scripts that incorporate building pipelines with filters such as sed, awk, sort and tr.
Assignment:
Write a C-shell script called hw2 and place it into your subdirectory 20ECES620801. Make the file executable to yourself. Suppose that we have a file containing records on customers, where each record is of the form:
Smith
Joe
561-9067
472 Oak Drive
Cleveland
OH
230027,
Berry
MAry,
945-9090
909 Howdy Doody Dr .
Cincinnati
OH
45238
AGRAWAL
JOHN
767-3313
131 Elm Street , Apt. 5
Chicago
IL,
78909
Berry
MAry,
945-9090
909 Howdy Doody Drive
Cincinnati
OH
45238
etc.
Your script should "clean-up" these records, i.e.,
JOHN AGRAWAL 767-3313 131 ELM STREET, APT. 5 CHICAGO, IL 78909 MARY BERRY 909 HOWDY DOODY DR. CINCINNATI, OH 45237 JOE SMITH 472 OAK DRIVE CLEVELAND, OH 230027 etc.Further, these labels must be SORTED with DUPLICATES REMOVED.
Your script hw2 should have one parameter for the input file.
HINT: Use filters sed and tr to clean each record up and convert each record into a single line, with the fields separated by a colon (see text pages 140-141). Use the filter sort to sort records and remove duplicates. Then use awk to print out the labels in the desired form.