




















| |
Lab 5
(Chapter 5)
Learning Objectives
- To practice editing text files
in pico
- To practice editing text files
in vi
- To practice editing text files
in emacs
Lab Work
- Log on to your UNIX system,
and execute the pico program on
a new, blank file.
- On the first line of the
file, type your first and last name.
- On the second line of the
file, type "The pico UNIX text editor allows you to do simple editing on
small text files efficiently".
- Use the
<Ctrl-O> command to write the
file to the default directory with the name lab51 .
- Print the file lab51 at your
UNIX system line printer.
- If you
have not done Practice Session 5.2 on pages 88 and 89 of the textbook, create
the file linespaced2 using the instructions on those pages before you do this
lab work exercise. After completing Practice Session 5.2, use
pico to add two(2) more lines of
text to the file named linespaced2 below lines 2 and 3, with similar
content to lines 2 and 3. Then add a line at the top of the file with your
first and last name on it. Save this new file with the name linespaced3, and
print it at your UNIX system line printer.
- What
version of pico did you use in
the above work, and how did you find this out?
- Use the
cat command to create a short
text file named shorty on your UNIX system, and then read that file into
pico, and add text to it. What
command did you use to read the cat-created
file into pico?
- Execute
pico on your UNIX system using
the –m command option. What
functionality did the –m option
give you in pico?
- Log on to your UNIX system,
and execute the vi program on a
new, blank file.
- On the first line of the
file, type your first and last name.
- On the second line of the
file, type " The vi UNIX text editor has almost all the features of a word
processor and tremendous flexibility in creating text files".
- Print the file to your UNIX
system line printer while you are still in vi. How do you accomplish
this, in a non-X Window System environment?
- What
vi command allows you to move to
the first line in the current buffer? What command allows you to move to the
last line in the buffer?
- Use the
set command to force
vi into a 30 column by 15 line
display of characters so that one screen of the display shows only 15 lines,
and text is automatically wrapped onto the next line after the 30th
character. How did you do this? (Hint: The
set all command shows the
current status of all vi
environment variables.)
- What
file in your home directory allows you to customize your
vi environment variables
permanently?
- What do
the following 8 vi commands do?
- 12dw
- 5dd
- 12o
- 5O
- c5b
- d5,12
- 12G
- 5yy
- Log on to your UNIX system,
and execute the emacs program on
a new, blank file, using the –nw
command option.
- On the first line of the
file, type your first and last name.
- On the second line of the
file, type "The emacs editor is the most complex and customizable of the
UNIX text editors".
- Print the file to your UNIX
system line printer while you are still in
emacs. How do you accomplish
this, in a non-graphical environment?
- Using
emacs, type in a paragraph of
text from one of your favorite books, but without altering the size or shape
of the emacs frame or using the
Enter key, use the word wrap feature of
emacs to format it exactly the way that it is printed in the book.
Print the file at your UNIX system line printer.
- Which
emacs commands move you forward
and backward one character, one word, one sentence, and one paragraph?
- Define
an emacs keyboard macro that
accomplishes a common editing task for you.
- Similar
to Practice Session 5.10 on pages 121,122 of the textbook, create, edit,
compile, link and execute a short C program of your choice in
emacs.
- Log out.
|