home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / doc / edtut / e1 < prev    next >
Encoding:
Text File  |  1979-01-10  |  4.8 KB  |  244 lines

  1. .nr PS 9
  2. .nr VS 11
  3. .if t .2C
  4. .SH
  5. Introduction
  6. .PP
  7. .ul
  8. Ed
  9. is a ``text editor'', that is, an interactive program
  10. for creating and modifying ``text'',
  11. using directions provided by a user at
  12. a terminal.
  13. The text is often a document
  14. like this one,
  15. or a program
  16. or perhaps data for a program.
  17. .PP
  18. This introduction is meant to simplify learning
  19. .ul
  20. ed.
  21. The recommended way to learn
  22. .ul
  23. ed
  24. is to read this document,
  25. simultaneously using
  26. .ul
  27. ed
  28. to follow the examples,
  29. then to read the description in section I of the
  30. .ul
  31. .UC UNIX
  32. .ul
  33. Programmer's Manual,
  34. all the while
  35. experimenting with
  36. .ul
  37. ed.
  38. (Solicitation of advice from experienced users is also useful.)
  39. .PP
  40. Do the exercises!
  41. They cover material not completely discussed
  42. in the actual text.
  43. An appendix summarizes the commands.
  44. .SH
  45. Disclaimer
  46. .PP
  47. This is an introduction and a tutorial.
  48. For this reason, no attempt is made to
  49. cover more than a part of the facilities that
  50. .ul
  51. ed
  52. offers
  53. (although this fraction includes the most useful and frequently used
  54. parts).
  55. When you have mastered the Tutorial,
  56. try
  57. .ul
  58. Advanced Editing on
  59. .ul
  60. .UC UNIX .
  61. Also,
  62. there is not enough space to explain basic
  63. .UC UNIX
  64. procedures.
  65. We will assume that you know how to log on to
  66. .UC UNIX ,
  67. and that you have at least a vague understanding
  68. of what a file is.
  69. For more on that, read
  70. .ul
  71. .UC UNIX
  72. .ul
  73. for Beginners.
  74. .PP
  75. You must also know what character to type as the end-of-line
  76. on your particular terminal.
  77. This character is the
  78. .UC RETURN
  79. key on most terminals.
  80. Throughout, we will refer to this character,
  81. whatever it is,
  82. as
  83. .UC RETURN .
  84. .SH
  85. Getting Started
  86. .PP
  87. We'll assume that you have logged in to
  88. your system
  89. and it has just printed the prompt character,
  90. usually either a
  91. .UL $
  92. or a
  93. .UL % .
  94. The
  95. easiest way to get
  96. .ul
  97. ed
  98. is to type
  99. .P1
  100. ed    (followed by a return)
  101. .P2
  102. You are now ready to go \-
  103. .ul
  104. ed
  105. is waiting for you to tell it what to do.
  106. .SH
  107. Creating Text \- the Append command ``a''
  108. .PP
  109. As your first problem, suppose you want to create some text
  110. starting from scratch.
  111. Perhaps you are typing the very first
  112. draft of a paper; clearly it will have to start
  113. somewhere, and undergo modifications later.
  114. This section will show how to get some text in, just to
  115. get started.
  116. Later we'll talk about how to change it.
  117. .PP
  118. When
  119. .ul
  120. ed
  121. is first started, it is rather like working
  122. with a blank piece of paper \- there is no text
  123. or information present.
  124. This must be supplied by the person using
  125. .ul
  126. ed;
  127. it is usually done
  128. by typing in the text, or by reading it into
  129. .ul
  130. ed
  131. from a
  132. file.
  133. We will start by typing in some text, and return shortly to how to
  134. read files.
  135. .PP
  136. First a bit of terminology.
  137. In
  138. .ul
  139. ed
  140. jargon, the text being
  141. worked on is said to be ``kept in a buffer.''
  142. Think of the
  143. buffer as a work space, if you like, or simply as the information
  144. that you are going to be editing.
  145. In effect the buffer is like the
  146. piece of paper, on which we will write things, then change some
  147. of them, and finally file the whole thing away for another day.
  148. .PP
  149. The user tells
  150. .ul
  151. ed
  152. what to do to his text
  153. by typing instructions called ``commands.''
  154. Most
  155. commands consist of a single letter,
  156. which must be typed in lower case.
  157. Each command is typed
  158. on a separate line.
  159. (Sometimes the command is preceded by information
  160. about what line or lines of text are to be affected \-
  161. we will discuss these shortly.)
  162. .ul
  163. Ed
  164. makes no response
  165. to most commands \- there is no prompting
  166. or typing of messages like ``ready''.
  167. (This silence is preferred
  168. by experienced users, but sometimes a hangup for beginners.)
  169. .PP
  170. The first command is
  171. .ul
  172. append,
  173. written as the letter
  174. .P1
  175. a
  176. .P2
  177. all
  178. by itself.
  179. It means ``append (or add) text lines to the buffer,
  180. as I type them in.''
  181. Appending is rather like
  182. writing fresh material on a piece of paper.
  183. .PP
  184. So to enter lines of text into the buffer,
  185. just type an
  186. .UL a
  187. followed by a
  188. .UC RETURN ,
  189. followed by the lines of text you want, like this:
  190. .P1
  191. a
  192. Now is the time
  193. for all good men
  194. to come to the aid of their party.
  195. \*.
  196. .P2
  197. .PP
  198. The only way to stop appending is to type a
  199. line that contains only a period.
  200. The ``\*.'' is used
  201. to tell
  202. .ul
  203. ed
  204. that you have finished appending.
  205. (Even experienced users forget that terminating ``\*.''
  206. sometimes.
  207. If
  208. .ul
  209. ed
  210. seems to be ignoring you,
  211. type an extra line with just ``\*.'' on it.
  212. You may then find you've added some garbage lines
  213. to your text, which you'll have to take out later.)
  214. .PP
  215. After the append command has been done, the buffer will
  216. contain the three lines
  217. .P1
  218. Now is the time
  219. for all good men
  220. to come to the aid of their party.
  221. .P2
  222. The
  223. .UL a '' ``
  224. and ``\*.'' aren't there, because they are
  225. not text.
  226. .PP
  227. To add more text to what you already have,
  228. just issue another
  229. .UL a
  230. command, and continue typing.
  231. .SH
  232. Error Messages \- ``?''
  233. .PP
  234. If at any time you make an error in the commands you type to
  235. .ul
  236. ed,
  237. it will tell you by typing
  238. .P1
  239. ?
  240. .P2
  241. This is about as cryptic as it can be,
  242. but with practice, you can usually
  243. figure out how you goofed.
  244.