----------------------- Exercise #13 for CST8129 due November 30, 2005 ----------------------- -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 1% of your total mark this term Due date: Before the end of your Lab period on Wednesday, November 30. The online deliverables for this exercise are to be submitted online via the T127 Linux Lab using the submit method described in the exercise description, below. No paper; no email; no FTP. Late-submission date: I will accept without penalty online exercises that are submitted late but before 12h00 (noon) on Friday, December 2. After that late-submission date, the exercise is worth zero marks. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. This exercise is due before the end of your Lab period on November 30. Location of the textbook CDROM files on the Lab workstations: The CDROM files for the Quigley textbook are available in the WT127 Lab under the directory: /home/cst8129/ -------- Synopsis -------- Write a single script exercise13script.sh to perform the operations given below. The script will contain one command line operation for each question. Input for each operation will come from the given CDROM file. Output will be as given in "Output Format", below. ------ Part I - sed ------ The input file for this exercise is the "datebook" file from Chapter 3 on the CDROM. (Do not use the Chapter 4 or Chapter 5 files - they are in DOS format and regexp will not properly match end-of-line.) From your Quigley textbook p.156 (Lab 2 sed exercise): Questions: 2, 3, 4, 5, 10a, 10d (answered in exercise13script.sh) ------ Part II - awk ------ The input file for this exercise is the "lab3.data" file from Chapter 6 on the CDROM. (Note: This file has been corrupted to have DOS format CR/LF line ends and trailing blanks at the end of some lines. Use of regexp '$' will not properly match end-of-line, and '$NF' gives the wrong output for many lines. Use other ways of getting answers.) Try to answer the questions using only *one* instance of AWK, without resorting to pipes and multiple executions or other programs. From your Quigley textbook p.187 (Lab 3 awk exercise): Questions: 1 to 9 (answered in exercise13script.sh) Question 10a-c: - Write a separate AWK script named "exercise13script.awk". - The script will contain several AWK expressions (see p.187). - Start the script with this comment line: #!/bin/awk -f - Make sure it is executable. Execute it with the data file: bash$ ./exercise13script.awk lab3.data The kernel will build and execute this command line: /bin/awk -f ./exercise13script.awk lab3.data See Notes file shell_script_execution.txt From your Quigley textbook p.202 (Lab 4 awk exercise): Questions: ALL (answered in exercise13script.sh) Outupt Format ------------- In front of each question in your script exercise13script.sh, insert an easily-visible echo statement showing the question number, e.g. echo "*** Q1. Print all the phone numbers." awk '.......................' echo "*** Q2. Print Dan's phone number." awk '.......................' ...etc... Submission ---------- Submit the finished and labelled (with your Assignment Label at the top) files for marking using the following Linux command line: $ ~alleni/bin/copy13 exercise13script.sh exercise13script.awk The copy13 program will copy the selected files to me for marking. You can copy the files more than once. Only the most recent copies will be marked. This exercise is due at the end of your lab period today. P.S. Did you spell all the label fields and file names correctly?