Question
Create a new directory, ~/UnixCourse/emacsAsst. Copy into that directory the file ~cs252/Assignments/emacsAsst/86-0.txt Give the command ~cs252/bin/emacsAsst This will, eventually, launch emacs for you. All work
Create a new directory, ~/UnixCourse/emacsAsst. Copy into that directory the file ~cs252/Assignments/emacsAsst/86-0.txt
Give the command
~cs252/bin/emacsAsst
This will, eventually, launch emacs for you.
All work in this assignment must be done within the emacs session launched by this command. If you need to quit for a while and later resume working on the assignment, you must use the same command to launch the new emacs session.
Visit the file 86-0.txt
In line 334, change the semicolon (;) to a period, and capitalize the first letter of the word immediately after it.
Somewhere within that file is the string you are conquered. Change it to ye are conquered.
Find the paragraph containing the word sentimentalities. Set the current region to be that paragraph, and execute the command upcase-initials-region.
Replace all occurrences in the file of the word knight by the word warrior (replacing the case variant Knight by Warrior). Note: this can be done with a single emacs command, or perhaps two commands. Searching for each individual occurrence of knight and manually changing it is not the way to go.
Save your changed file, and exit emacs.
If you have made all of he changes successfully, you will receive the access code.
If not, you will receive some information about what seems to be wrong. You will need to go back to step 2 and complete the changes to the file (or go back to step 1 if you have completely trashed your file).
But whether you got the access code or not, move on to the next step. This will help you to gather information on exactly what changes you were able to make.
The Unix diff command. diff examines two files and prints a report on the lines that are different (new lines added, old ones deleted, or lines changed). Try
diff 86-0.txt ~cs252/Assignments/emacsAsst/86-0.txt | less
comparing your edited file against the original one, as a way of seeing exactly what changes you have made. If, in fact, when you exited emacs, the grading script complained that your file was not altered correctly, you may find this command helpful in seeing whether you did indeed make the changes you intended, and whether you may have inadvertently changed other parts of the file to the degree that the grading script could not longer locate the desired changes in your file.
(Of course, the diff command is mainly useful in showing the changes that you did make. It cant show you the changes you did not make, but should have. Some of the commands from earlier lessons may be useful there, however. For example, if you get a message complaining that you did not replace all the knight s in the text, you might want to try a different command from an earlier lesson:
grep -i knight 86-0.txt
may show you what is wrong.)
But even if you did get the access code indicating successful completion of the assignment, try the above diffcommand. Its a useful tool that can save you a lot of grief in many situations. In a later lesson, well also see the emacs commands ediff-files, which provides an interactive form of diff, and emerge-files which provides an interactive way to combine changed portions from two different files into a third, combined file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started