Due date: Monday, October 23 at 5am
Late policy: no late make-up homeworks accepted.
Please read all the instructions carefully. Remember, everything is case-sensitive!
You should do all the work on your own without asking for any assistance from other people and without helping other students. In case you need help, you should:
Everybody is welcome to do these make-up homeworks or parts of them. Nothing will be subtracted from your existing score if your answers are incorrect, so there is no risk involved (other than the risk of not getting some extra points).
Everybody is welcome to try doing this HW, but if you got at least 6 points for the original Part I, you will not receive any additional credit. If you had less than 6 points for the original part I, you can get up to 6-(original score) points on this one.
(1 point) Remove cs114-HW1 subdirectory from your home directory.
(1 point) Make sure that ~/cs114-HW1-mu/..../A directory exists and you are the only one who has any kind of access permissions for it.
(1 point) Go to HW1 subdirectory of the home directory of the user cs114. Somewhere inside of it there is file4. Copy file4 to your A directory.
(1 point) Make sure that you have only read access, group has only execute access and others have only write access to file4 (create an empty file4 if you haven't found the "real" one).
Now you are ready to have Part I graded. Run ~cs114/bin/grade-hw1-mu. If you run it several times, only the first grade will be counted, so do not run it until you are ready to turn in your homework. You should get a confirmation e-mail after your HW is received.
You only get credit for this part if you haven't submitted it before.
(0.8 points) Using ~cs114/bin/pine on babbage send an e-mail to email@example.com with a short note explaining what's your main reason for taking CS114.
The subject of the e-mail must be
HW1mu <your 6-digit Cornell ID>
For example: HW1mu 123456.
You will get a confirmation e-mail at your NetId@cornell.edu address.
This is something you've probably already done for the "original" HW2, but if you modified file4 or file5, make sure you get a fresh copy.
(1) (0 points) Create a subdirectory cs114-HW2 in your home directory. Make sure you are the only one who has any kind of access permissions to it.
(2) (0 points) Go to ~cs114/HW2 directory. It has a subdirectory set up for each of the CS114 students. Copy all the files from ~cs114/HW2/your_netid to your cs114-HW2 directory. (In case you are wondering - these files contain lines semi-randomly picked from a bunch of man pages).
For this section, use vi, vim or ~cs114/bin/vim. Some of these problems are quite tricky, so triple-check your results. You may find diff utility useful for checking what happened.
(3) (1 point) In file4, append space, your netid, and then another space right before the last symbol on all non-empty lines among the lines 30 through 328. Example: if your NetID is abc1, and file4 contains a line
you should change it into
qwert abc1 y
Don't forget those spaces!
(4) (2 points) In file5, on all the lines that have at least two | symbols,
replace the second | symbol with a & symbol.
ab | cd | ef |
ab | cd & ef |
(5) (0 points) Using man command on babbage, read the grep man page and find out how to tell it to count the number of matches.
(6) (2 points) In file6, count the total number of all of the following:
(7) (2 points) In file7, count the number of lines that have an n
somewhere before and somewhere after each a (this includes lines with no a's
Put this number onto the second line of ~/cs114-HW2/answer-mu file. Do not put anything else onto that line.
Examples: The following lines should be counted:
while the following lines should not be counted:
Hint: All the correct answers for problems (6) and (7) are between 150 and 300. If your answer is not in that range, it must be wrong.
To submit make-up homework 2, run ~cs114/bin/grade-hw2-mu. As usual, only the first submission counts.