Due date: Friday, October 13 at noon
|After||and before||you get|
|noon on Friday, October 13||100% of the grade|
|12:01 pm on Friday, October 13||5:00 am on Saturday, October 14||80% of the grade|
|5:01 am on Saturday, October 14||5:00 am on Monday, October 16||50% of the grade|
|5:01 am on Monday, October 16||nothing|
This homework will be graded out of 15 points. Future homeworks may "cost" more.
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,
(1) (1 point) 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 problems (3-5) 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) (2 points) In file1, prepend your Net-ID (your login) and a space to lines 10 trough 350. For example, if I would be doing this HW, then I would change the line
Hint: Use VI substitution command.
(4) (2 points) In file2, replace each lower-case letter that go before r in the alphabet (excluding r itself) with two symbols \/.
Example:: 12abcrs5dA should become 12\/\/\/rs5\/A.
(5) (3 points) In file3, change all the lines that contain at least 2 | symbols in the following way:
(6) (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.
(7) (0 points) Create a file named answer in your cs114-HW2 directory.
(8) (3 points) Count the number of lines in file4 that have at least 3 occurences of some 2-character string (each line can have its own 2-character string). Put this number on the first line of the answer file (don't put anything else onto that line).
Example: qw1~wt1~aaass1~xce should be counted because 1~ appears 3 times.
(9) (1 point) Same as (8), but when the first of the two symbols in that string is not a lower-case a. Write the number in the second line of the answer file.
(10) (3 points) In the file5, count the number of lines that either
To submit your HW, run ~cs114/bin/grade-hw2. The script will work as many times as you run it, but you will only receive credit for your first submission. If something goes wrong, please let me know ASAP.