------------------------------------- README.txt - Exercise #4 Instructions ------------------------------------- Ian! D. Allen - idallen@ncf.ca This is what you must do for Exercise #4. This compressed archive contains several files in a hidden directory. 1) Create an empty directory and cd into it. This will be your "submission directory". Make sure there are no files in this new, empty directory. 2) Extract the contents of the exercise04.tar.gz file. Look for and find the compressed text file list.txt.gz Find the last 5 digits of your Student Number in this file. Beside those digits is a list of 15 question numbers. You must answer only these 15 question numbers, below. 3) Now find the compressed text file questions.txt.gz Put an uncompressed copy of the file into "myanswers.txt". Use VI to edit the "myanswers.txt" file and answer your assigned 15 questions by replacing the numbered question lines with the appropriate answer output, as shown below. 4) Find the compressed text file answers.txt.gz This file contains sample correct answers for the questions. You can copy these answers or generate your own. If you do copy the answers from this file, make sure the answers reflect *your* userid and not the userid in the answers.txt file! (Edit the userid to be yours.) For example, if you were assigned question number 45, you would look for question number 45 in the myanswers.txt file: $ echo 'a b' hi there 45. REPLACE THIS ENTIRE LINE: what output here? Either run the command shown, or find the same question in the answers.txt file. Use VI to replace the indicated line with the correct output answer, as follows: $ echo 'a b' hi there a b hi there You must replace the entire "REPLACE THIS" line with the exact answer, including spaces and punctuation. The easiest way to do this accurately is to run two windows: In one window, follow the questions.txt file and run the commands needed to generate the output, and redirect the output of the last command into a temporary file. In the other window, edit the myanswers.txt file and use ":r tempfile" to read in the temporary file after each answer. Using the above example, in one window I would type this: $ echo 'a b' hi there >tempfile In my other VIM editor window, I would position my cursor on question 45 in myanswers.txt and then type ":r tempfile" to read in the output line from the temp file that I just created. The myanswers.txt file would then look like this: $ echo 'a b' hi there 45. REPLACE THIS ENTIRE LINE: what output here? a b hi there I would then delete the entire "REPLACE THIS" line, leaving only the correct answer line in myanswers.txt: $ echo 'a b' hi there a b hi there Repeat for all 15 questions. You can make sure your answer is correct by verifying it against the correct answers in the answers.txt file. (Make sure you get the quotes correct on those lines!) Do not delete or change anything else in the myanswers.txt file other than the 15 lines that are your assigned questions. Leave the rest of the file exactly as it was. 5) When you are done, use diff to compare the original questions.txt file with your modified version in myanswers.txt and save the output in a file named diffout.txt. You should see *only* 15 sections of differences, one for each question you answered. The output might resemble this: $ diff questions.txt myanswers.txt >diffout.txt $ cat diffout.txt 154c154 < 45. REPLACE THIS ENTIRE LINE: what output here? --- > a b hi there [...repeat for each of 15 questions...] If you see more than 15 sections with differences, something is wrong! 6) Put a copy of your Exterior Assignment Submission Label into a file named "file1.txt" in this submission directory. Use the exact 7-line (plus optional comments) format described online and in previous exercises. (Make sure your file1.txt file has at least seven lines in it.) 7) Put the output of "pwd" in this directory into a file named "file2.txt". 8) Put the output of running the command "sum *" in this directory into a file named "file3.txt". 9) Put the output of running the command "wc *" in this directory into a file named "file4.txt". 10) Put the output of running the command "ls -lia" in this directory into a file named "file5.txt". 11) Submit everything in this directory for marking as Exercise 04, using the following ACADUNIX command line: $ ~alleni/bin/submit 04 * This "submit" program will copy everything ("*") in the current directory to my Exercise 04 directory for marking. (The GLOB pattern "*" matches all non-hidden files in the current directory.) Your final submission should include only these files: file1.txt file2.txt file3.txt file4.txt file5.txt questions.txt myanswers.txt diffout.txt You don't need to submit any of the other files. 12) Verify that you submitted everything, using this command line: $ ~alleni/bin/submit 04 -l You may redo this exercise and re-submit your results as many times as you like. I will mark the most recent submission that is submitted before the final hand-in cutoff date. (Make sure you include all the above files in every submission.) For Exercise 04, always use "04" as the first argument to "submit".