CSIS 82 ASSIGNMENT 4 Chapter 5... The VI Editor Due: Next Thursday

advertisement
CSIS 82 ASSIGNMENT 4
Chapter 5 & Handouts
The VI Editor
Due: Next Thursday
1) Log into terra. Use the vi editor to create a file called gtysbrg.txt which contains the following
paragraph with the same alignment and format. Put a line break at the end of each line. When you are finished,
correct any mistakes you made during typing, save the file, and exit vi.
Four score and seven years ago our fathers brought forth on this continent
a new country, conceived in liberty, and dedicated to the idea
that all men are created equal. Now we are engaged in a great war,
testing whether our nation, or any nation so conceived and so dedicated
can last. We are met on a great battlefield of that war. We have
come to dedicate a portion of that field as a final resting-place for
those who here gave their lives that that nation might live.
2) open the file you created for problem 1. Change the previously typed paragraph to look like the following.
Changes are highlighted in the text with underlining (you do not underline in vi!). You will need to add some text,
change some text, and delete some text. When you're finished, save the new file with the name gtysbrg2.txt, and
exit vi.
Four score and seven years ago our fathers brought forth on this continent
a new nation, conceived in liberty, and dedicated to the proposition that
all men are created equal. Now we are engaged in a great civil war,
testing whether that nation, or any nation so conceived and so dedicated,
can long endure. We are met on a great battlefield of that war. We have
come to dedicate a portion of that field as a final resting-place for
those who here gave their lives that that nation might live.
It is very fitting and proper that we should do this. But in a
larger sense, we cannot dedicate nor consecrate nor can we hallow
this ground. The brave men, who died here, who struggled here have
consecrated it far above our power to add or detract. The world will
little note, nor long remember what we say here, but it can never forget
what they did here.
3) Open the file you created for problem 1. Change the previously typed paragraph to look like the following.
Changes are highlighted in the text with underlining (you do not underline in vi!). You will need to add some text,
change some text, and delete some text. When you're finished, save the new file with the same name
(gtysbrg2.txt), and exit vi.
Four score and seven years ago our fathers brought forth on this continent
a new nation, conceived in liberty, and dedicated to the proposition that
all men are created equal. Now we are engaged in a great civil war,
testing whether that nation, or any nation so conceived and so dedicated,
can long endure. We are met on a great battlefield of that war. We have
come to dedicate a portion of that field as a final resting-place for
those who here gave their lives that that nation might live.
It is altogether fitting and proper that we should do this. But in a
larger sense, we cannot dedicate, we cannot consecrate, we cannot hallow
this ground. The brave men, living and dead, who struggled here have
consecrated it far above our poor power to add or detract. The world will
little note, nor long remember what we say here, but it can never forget
what they did here.
It is for us the living, rather to be dedicated here to the unfinished
work which they who fought here have thus far so nobly advanced. It is
rather for us, to be here dedicated to the great task remaining before
us, that from these honored dead we take increased devotion to that cause
for which they gave the last full measure of devotion; that we here
highly resolve that these dead shall not have died in vain; that this
nation, under God, shall have a new birth of freedom, and that government
of the people, by the people, for the people, shall not perish from the
earth.
Abraham Lincoln
Sixteenth President of the United States
Gettysburg, Pennsylvania
November 19, 1863
4) File Manipulation: the file make_scavenger in the cs82 directory on terra contains a script that
produces a number of directories and files used in the scavenger hunt problem from last week.
Copy the file to your home directory. For this assignment you're going to use vi to modify the
directory names for all of the files created so it creates the content in your home directory.
a) First, make a directory in your home directory called scav82.
b) open the file make_scavenger using vi
c) using the substitute command, replace all occurrences of /home/mpc80change permissions
on the file to give you the user
with
home/mpc82/mpc82aXX/scav82
where XX is your id on terra
d) save the file, exit vi
e) change permissions on the file to give you (the user) execute permission
f) Execute the scipt using the command
./make_scavenger
g) If you did this correctly, you should be able to do an ls and find the directory scavenger hung
structure reproduced in your own scav82 directory
After completing this assignment, check once again that you have the properly named files in your home
directory. I will collect these next week using the cp command. If your file is named improperly or placed in a
directory besides your home directory, I will not be able to collect it and you will not get points for the assignment!
Download