In this exercise you create an exrc file first make sure


EXERCISE 1 -

The file hamlet will be used for these exercises. Write in command and/or result of activity

Key in the file "Hamlet" provided as an attachment.

Then enter input mode with i (or a) and enter text. Strike "ESC" key to re-enter command mode when you are finished. Then save the file by typing: wq

1. Invoke vi on the file:

2. Go to line 10 of the file.

3. Go to the first line of the file.

4. Go to the last line of the file.

5. Go up 5 lines.

6. Go forward 3 words.

7. Go back to the first line of the file.

8. Go to the end of this line.

You can leave vi now if you wish by typing   :q  (or  :q! ).

EXERCISE 2 -

In this exercise you are going to add some text to the file hamlet. Write commands.

1. Invoke the vi editor on your copy of the file hamlet.

2. After line 5, add a new line of text.

3. At the end of line 2, add a word.

4. At the beginning of line 4, insert a word.

5. Insert 2 new lines of text before the first line.

6. Append 3 new lines of text after the last line.

7. Go to the top of the file. Now delete the first 14 lines with one command.

8. That was an error.-Undo it.

9. Delete the current character.

10. Quit vi without saving your changes by typing:  :q!

EXERCISE 3 -

In this exercise you create an .exrc file.

1. First make sure you are in your home directory by typing cd  enter

2. Then invoke the vi editor by typing:

If .exrc already exists, vi will display it. Otherwise, vi will create it.

3. If the file already exists, but its contents aren't acceptable delete whatever you do not want with dd or dw.

4. Enter input mode by typing i (or a) and enter:

5. Strike "ESC" to enter command mode, then type:

This saves the file. The next time you edit something, showmode, number, and wrapscan (or whatever your file contains) should all be in effect. "wrapscan" will be described in the next section.

EXERCISE 4 -

1. Edit hamlet and change the name of this play to gamlet.

2. Go to the 3rd word on line 6 and delete it.

3. Search for and delete the first occurrence of the word "and". Now repeat this change throughout the file.

Hint: Use the techniques for repeating a search and repeating a command.

4. Use delete and put commands to make a copy of the last line of the file so that the last 2 lines of the file are identical.

5. Now move one copy of this line before the first line of the file.

6. Find the first and then the second occurrence of the word "the". (Do not change "whether".)

Quit  vi  without saving your changes by typing:  :q!

EXERCISE 5 -

1. Edit Hamlet one more time and make any changes you wish (as long as those changes are easily recognizable).

Now save your work (but do not quit).

2. Make some more easily recognized changes and save your work under the name hamlet1 (but do not quit).

3. Without quitting vi, find out what directory you are working in by using the command pwd.

Hint: You will have to use a colon command  to have a subshell issue this command.

4. Make one more change to your current buffer. Now try to quit without saving your work, by typing:  :q

5. What happened? Try it again, only be more emphatic this time.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Operating System: In this exercise you create an exrc file first make sure
Reference No:- TGS02260589

Expected delivery within 24 Hours