Commit | Line | Data |
---|---|---|
47d38f87 BJ |
1 | .ND Draft:\ \ \ April 5, 1979 |
2 | .RP | |
3 | .TL | |
4 | Edit: A Tutorial | |
5 | .AU | |
6 | Ricki Blau | |
7 | .AU | |
8 | James Joyce | |
9 | .AI | |
10 | Computing Services | |
11 | University of California | |
12 | Berkeley, California 94720 | |
13 | .AB | |
14 | .PP | |
15 | This narrative introduction to the use of the text editor | |
16 | .I edit | |
17 | assumes no prior familiarity with computers or with text editing. | |
18 | Its aim is to lead the beginning \s-2UNIX\(dg\s+2 user through the | |
19 | .FS | |
20 | \(dgUNIX is a trademark of Bell Laboratories. | |
21 | .FE | |
22 | fundamental steps of writing and revising a file of text. | |
23 | Edit, | |
24 | a version of the text editor | |
25 | .I ex, | |
26 | was designed to provide an informative environment | |
27 | for new and casual users. | |
28 | .PP | |
29 | This edition documents Version 2.0 of | |
30 | .I edit | |
31 | and | |
32 | .I ex . | |
33 | .PP | |
34 | We welcome comments and suggestions about this tutorial | |
35 | and the \s-2UNIX\s+2 documentation in general. | |
36 | Contact the \s-2UNIX\s+2 consultant in 217 Evans, 642-4072. | |
37 | .AE | |
38 | .SH | |
39 | .PP | |
40 | Text editing using a terminal connected to a computer | |
41 | allows a user to create, modify, and print text | |
42 | easily. Creating text is as easy as typing it much | |
43 | as one would on an electric typewriter. | |
44 | Modifying text involves telling the text editor | |
45 | what to add, change, or delete. | |
46 | Text is printed by giving the proper | |
47 | command to print the file contents, with or | |
48 | without special instructions as to the format | |
49 | of the desired output. | |
50 | .PP | |
51 | These lessons assume no prior familiarity with computers | |
52 | or with text editing. | |
53 | They consist of a series of text editing sessions | |
54 | which will lead you through the fundamental steps | |
55 | of creating and revising a file of text. | |
56 | After scanning each lesson and before beginning the next, | |
57 | you should follow the examples at a terminal to get a feeling | |
58 | for the actual process of text editing. | |
59 | Set aside some time for experimentation, | |
60 | and you will soon become familiar with using the | |
61 | computer to write and modify text. | |
62 | In addition to the actual use of the text editor, | |
63 | other features of \s-2UNIX\s0 will be very important to your work. | |
64 | You can begin to | |
65 | learn about these other features by | |
66 | reading ``Communicating with \s-2UNIX\s0'' | |
67 | or one of the other tutorials | |
68 | which provide a general introduction to the system. | |
69 | You will be ready to proceed with this lesson as soon as | |
70 | you are familiar with your terminal and its special keys, | |
71 | the login procedure, and the ways of correcting typing errors. | |
72 | Let's first define some terms: | |
73 | .sp .5 | |
74 | .IP program 12 | |
75 | A set of instructions given to the computer, | |
76 | describing the sequence of steps which the computer performs | |
77 | in order to accomplish a specific task. | |
78 | As an example, a series of steps to balance your | |
79 | checkbook is a program. | |
80 | .IP UNIX | |
81 | \s-2UNIX\s0 is a special type of program, | |
82 | called an operating system, that supervises the machinery | |
83 | and all other programs comprising the total | |
84 | computer system. | |
85 | .IP edit | |
86 | .I edit | |
87 | is the name of the \s-2UNIX\s0 text editor which you will be learning to use, | |
88 | a program that aids you in writing or revising text. | |
89 | Edit was designed for beginning users, | |
90 | and is a simplified version of an editor called | |
91 | .I ex. | |
92 | .IP file | |
93 | Each \s-2UNIX\s0 account is allotted | |
94 | space for the permanent storage of information, such as programs, data or text. | |
95 | A file is a logical unit of data, | |
96 | for example, an essay, a program, or a chapter from a book, | |
97 | which is stored on a computer system. | |
98 | Once you create a file, | |
99 | it is kept until you instruct the system to remove it. | |
100 | You may create a file during one \s-2UNIX\s0 session, log out, | |
101 | and return to use it at a later time. | |
102 | Files contain anything you choose to write and store in them. | |
103 | The sizes of files vary to suit your needs; | |
104 | one file might hold only a single number while another might contain | |
105 | a very long document or program. | |
106 | The only way to save | |
107 | information from one session to the next is to store it in a file. | |
108 | .IP filename | |
109 | Filenames are used to distinguish one file from another, | |
110 | serving the same purpose as the labels of manila | |
111 | folders in a file cabinet. | |
112 | In order to write or access information in a file, | |
113 | you use the name of that file in a \s-2UNIX\s0 command, | |
114 | and the system will automatically locate the file. | |
115 | .IP disk | |
116 | Files are stored on an input/output device called a disk, | |
117 | which looks something like a stack of phonograph records. | |
118 | Each surface is coated with a material similar to the | |
119 | coating on magnetic recording tape, on which information is recorded. | |
120 | .IP buffer | |
121 | A temporary work space, made available to the user | |
122 | for the duration of a session of text editing | |
123 | and used for building and modifying | |
124 | the text file. | |
125 | We can imagine the buffer as a blackboard that is | |
126 | erased after each class, where each session with the editor | |
127 | is a class. | |
128 | .sp 2 | |
129 | .SH | |
130 | .ce 1 | |
131 | Session 1: Creating a File of Text | |
132 | .sp 1 | |
133 | .PP | |
134 | To use the editor you must first make contact with the computer | |
135 | by logging in to \s-2UNIX\s0. | |
136 | We'll quickly review the standard \s-2UNIX\s0 login procedure. | |
137 | .PP | |
138 | If the terminal you are using is directly linked to the computer, | |
139 | turn it on and press carriage return, | |
140 | usually | |
141 | labelled ``\s-1RETURN\s+1''. | |
142 | If your terminal connects with the computer over a telephone line, | |
143 | turn on the terminal, dial the system access number, | |
144 | and, when you hear a high-pitched tone, place the receiver of | |
145 | the telephone in the acoustic coupler. | |
146 | Press carriage return once and await the login message: | |
147 | .DS I 1i | |
148 | :login: | |
149 | .DE | |
150 | .PP | |
151 | Type your login name, which identifies you to \s-2UNIX\s0, | |
152 | on the same line as the login | |
153 | message, and press carriage return. | |
154 | If the terminal you are using has both upper | |
155 | and lower case, be sure you enter your login name | |
156 | in lower case; otherwise \s-2UNIX\s0 assumes your terminal | |
157 | has only upper case and will not recognize lower case | |
158 | letters you may type. | |
159 | \s-2UNIX\s0 types ``:login:'' and you reply | |
160 | with your login name, for example ``susan'': | |
161 | .DS I 1i | |
162 | :login: \fBsusan\fR \fI(and press carriage return)\fR | |
163 | .DE | |
164 | (In the examples, input typed by the user appears in | |
165 | .B "bold face" | |
166 | to distinguish it from the responses from \s-2UNIX\s0.) | |
167 | .PP | |
168 | \s-2UNIX\s0 will next respond with a request for a password | |
169 | as an additional precaution to prevent | |
170 | unauthorized people from using your account. | |
171 | The password will not appear when you type it, | |
172 | to prevent others from seeing it. | |
173 | The message is: | |
174 | .DS I 1i | |
175 | Password: \fI(type your password and press carriage return)\fR | |
176 | .DE | |
177 | If any of the information you gave during the login | |
178 | sequence was mistyped or incorrect, | |
179 | \s-2UNIX\s0 will respond with | |
180 | .DS I 1i | |
181 | Login incorrect. | |
182 | .if t .sp .2v | |
183 | .if n .sp 1 | |
184 | :login: | |
185 | .DE | |
186 | in which case you should start the login process anew. | |
187 | Assuming that you have successfully | |
188 | logged in, \s-2UNIX\s0 | |
189 | will print the message of the day and eventually will present | |
190 | you with a % at the beginning of a fresh line. | |
191 | The % is the \s-2UNIX\s0 prompt symbol | |
192 | which tells you that \s-2UNIX\s0 is ready to accept a command. | |
193 | .bd I 3 | |
194 | .SH | |
195 | Asking for \fIedit\fP | |
196 | .fl | |
197 | .bd I | |
198 | .PP | |
199 | You are ready to tell \s-2UNIX\s0 that you | |
200 | want to work with edit, the text editor. | |
201 | Now is a convenient time to choose | |
202 | a name for the file of text which you are about to create. | |
203 | To begin your editing session type | |
204 | .B edit | |
205 | followed by a space and then the filename | |
206 | which you have selected, for example ``text''. | |
207 | When you have completed the command, | |
208 | press carriage return and wait for edit's response: | |
209 | .DS I 1i | |
210 | % \fBedit text\fP \fI(followed by a carriage return)\fR | |
211 | "text" No such file or directory | |
212 | : | |
213 | .DE | |
214 | If you typed the command correctly, | |
215 | you will now be in communication with edit. | |
216 | Edit has set aside a buffer for use as | |
217 | a temporary working space during your current editing session. | |
218 | It also checked to see if the file you named, ``text'', | |
219 | already existed. | |
220 | As we expected, it was unable to find such a file | |
221 | since ``text'' is the name of the new file that we will create. | |
222 | Edit confirms this with the line: | |
223 | .DS I 1i | |
224 | "text" No such file or directory | |
225 | .DE | |
226 | On the next line appears edit's prompt ``:'', | |
227 | announcing that edit expects a command from you. | |
228 | You may now begin to create the new file. | |
229 | .SH | |
230 | The ``not found'' message | |
231 | .PP | |
232 | If you misspelled edit by typing, say, ``editor'', | |
233 | your request would be handled as follows: | |
234 | .DS I 1i | |
235 | % \fBeditor\fP | |
236 | editor: not found | |
237 | % | |
238 | .DE | |
239 | Your mistake in calling edit ``editor'' was | |
240 | treated by \s-2UNIX\s0 as a request | |
241 | for a program named ``editor''. | |
242 | Since there is no program | |
243 | named ``editor'', | |
244 | \s-2UNIX\s0 reported that the program was ``not found''. | |
245 | A new % indicates that \s-2UNIX\s0 is ready for another command, | |
246 | so you may enter the correct command. | |
247 | .SH | |
248 | A summary | |
249 | .PP | |
250 | Your exchange with \s-2UNIX\s0 as you logged in and made contact with edit | |
251 | should look something like this: | |
252 | .DS I 1i | |
253 | :login: \fBsusan\fP | |
254 | Password: | |
255 | Computer Center \s-2UNIX\s0 System | |
256 | \&... A Message of General Interest ... | |
257 | % \fBedit text\fP | |
258 | "text" No such file or directory | |
259 | : | |
260 | .DE | |
261 | .SH | |
262 | Entering text | |
263 | .PP | |
264 | You may now begin to enter text into the buffer. | |
265 | This is done by \fIappending\fP text to whatever | |
266 | is currently in the buffer. | |
267 | Since there is nothing in the buffer at the moment, | |
268 | you are appending text to nothing; in effect, you | |
269 | are creating text. | |
270 | Most edit commands have two forms: | |
271 | a word which describes what the command does | |
272 | and a shorter abbreviation of that word. | |
273 | Either form may be used. | |
274 | Many beginners find the full command names | |
275 | easier to remember, | |
276 | but once you are familiar with editing you may | |
277 | prefer to type the shorter abbreviations. | |
278 | The command to input text is ``append'' | |
279 | which may be abbreviated ``a''. | |
280 | Type | |
281 | .B append | |
282 | and press carriage return. | |
283 | .DS I 1i | |
284 | % \fBedit text | |
285 | \fR:\|\fBappend | |
286 | .R | |
287 | .DE | |
288 | .SH | |
289 | .bd I 3 | |
290 | Messages from | |
291 | .I edit | |
292 | .fl | |
293 | .bd I | |
294 | .PP | |
295 | If you make a mistake in entering a command and | |
296 | type something that edit does not recognize, | |
297 | edit will respond with a message | |
298 | intended to help you diagnose your error. | |
299 | For example, if you misspell the command to input text by typing, | |
300 | perhaps, ``add'' instead of ``append'' or ``a'', | |
301 | you will receive this message: | |
302 | .DS I 1i | |
303 | :\|\fBadd\fR | |
304 | add: Not an editor command | |
305 | : | |
306 | .DE | |
307 | When you receive a diagnostic message, | |
308 | check what you typed in order to determine what | |
309 | part of your command confused edit. | |
310 | The message above means that edit | |
311 | was unable to recognize your mistyped command | |
312 | and, therefore, did not execute it. | |
313 | Instead, a new ``:'' | |
314 | appeared to let you know that | |
315 | edit is again ready to execute a command. | |
316 | .SH | |
317 | Text input mode | |
318 | .PP | |
319 | By giving the command ``append'' (or using the abbreviation ``a''), | |
320 | you entered | |
321 | .I | |
322 | text input mode, | |
323 | .R | |
324 | also known as | |
325 | .I | |
326 | append mode. | |
327 | .R | |
328 | When you enter text input mode, | |
329 | edit responds by doing nothing. | |
330 | You will not receive any prompts | |
331 | while in text input mode. | |
332 | This is your signal | |
333 | that you are to begin entering lines of text. You can enter | |
334 | pretty much anything you want on the lines. The | |
335 | lines are transmitted one by one to the buffer | |
336 | and held there during the editing session. | |
337 | You may append as much text as you want, and | |
338 | .I | |
339 | when you wish to stop entering text lines you should | |
340 | type a period as the only character on the line | |
341 | and press carriage return. | |
342 | .R | |
343 | When you give this signal that you want to stop appending text, | |
344 | you will exit from text input mode and reenter command mode. | |
345 | Edit will again | |
346 | prompt you for a command by printing ``:''. | |
347 | .PP | |
348 | Leaving append mode does not destroy the text in | |
349 | the buffer. You have to leave append | |
350 | mode to do any of the other kinds of editing, | |
351 | such as changing, adding, or printing text. | |
352 | If you type a period as the first character and | |
353 | type any other character on the same line, | |
354 | edit will believe you want to remain in append mode | |
355 | and will not let you out. | |
356 | As this can be very frustrating, | |
357 | be sure to type | |
358 | .B only | |
359 | the period and carriage return. | |
360 | .PP | |
361 | This is as good a place as any to learn an important | |
362 | lesson about computers and text: a blank space is | |
363 | a character as far as a computer is concerned. | |
364 | If you so much as type a period followed by a blank | |
365 | (that is, type a period and then the space bar on the keyboard), | |
366 | you will remain in append mode with the last line of text | |
367 | being: | |
368 | .DS I 1i | |
369 | .B | |
370 | .ps +2 | |
371 | \&. | |
372 | .ps -2 | |
373 | .R | |
374 | .DE | |
375 | Let's say that the lines of text you enter are | |
376 | (try to type | |
377 | .B exactly | |
378 | what you see, including ``thiss''): | |
379 | .DS I 1i | |
380 | .B | |
381 | This is some sample text. | |
382 | And thiss is some more text. | |
383 | Text editing is strange, but nice. | |
384 | \&. | |
385 | .R | |
386 | .DE | |
387 | The last line is the period followed by a carriage return | |
388 | that gets you out of append mode. | |
389 | If while typing the line you hit an incorrect key, | |
390 | recall that | |
391 | you may delete the incorrect character | |
392 | or cancel the entire line of input by erasing in the usual way. | |
393 | Refer to ``Communicating with \s-2UNIX\s0'' if you need to review | |
394 | the procedures for making a correction. | |
395 | Erasing a character or cancelling a line must be done | |
396 | before the line has been completed by a carriage return. | |
397 | We will discuss changes in lines already typed in session 2. | |
398 | .SH | |
399 | Writing text to disk | |
400 | .PP | |
401 | You are now ready to edit the text. The simplest kind of editing | |
402 | is to write it to disk as a file for safekeeping | |
403 | after the session is over. | |
404 | This is the only way to save information from one session to the next, | |
405 | since the editor's buffer is temporary and will last only until the | |
406 | end of the editing session. | |
407 | Thus, learning how to write a file to disk is second in | |
408 | importance only to entering the text. | |
409 | To write the contents of the buffer to a disk | |
410 | file, use the command ``write'' | |
411 | (or its abbreviation ``w''): | |
412 | .DS I 1i | |
413 | :\|\fBwrite | |
414 | .R | |
415 | .DE | |
416 | Edit will copy the buffer to a disk file. | |
417 | If the file does not yet exist, | |
418 | a new file will be created automatically | |
419 | and the presence of a ``[New file]'' will be noted. | |
420 | The newly-created file will be given the name specified when | |
421 | you entered the editor, in this case ``text''. | |
422 | To confirm that the disk file has been successfully written, | |
423 | edit will repeat the filename and give | |
424 | the number of lines and the total | |
425 | number of characters in the file. | |
426 | The buffer remains unchanged by the ``write'' command. | |
427 | All of the lines which were written to disk will still be | |
428 | in the buffer, | |
429 | should you want to modify or add to them. | |
430 | .PP | |
431 | Edit must have a filename to use before it can write a file. | |
432 | If you forgot to indicate the name of the file | |
433 | when you began the editing session, | |
434 | edit will print | |
435 | .DS I 1i | |
436 | No current filename | |
437 | .DE | |
438 | in response to your write command. | |
439 | If this happens, you can specify the filename in a new write command: | |
440 | .DS I 1i | |
441 | :\|\fBwrite text | |
442 | .R | |
443 | .DE | |
444 | After the ``write'' (or ``w'') type a space and then the name of the file. | |
445 | .SH | |
446 | Signing off | |
447 | .PP | |
448 | We have done enough for this first lesson on using the | |
449 | \s-2UNIX\s0 text editor, and are ready to quit the session with edit. | |
450 | To do this we type ``quit'' (or ``q'') and press carriage return: | |
451 | .DS I 1i | |
452 | :\|\fBwrite | |
453 | .R | |
454 | "text" [New file] 3 lines, 90 characters | |
455 | :\|\fBquit\fR | |
456 | % | |
457 | .DE | |
458 | The % is from \s-2UNIX\s0 to tell you that your session with edit is | |
459 | over and you may command \s-2UNIX\s0 further. Since we want | |
460 | to end the entire session at the terminal we also need to | |
461 | exit from \s-2UNIX\s0. | |
462 | In response to the \s-2UNIX\s0 prompt of ``\|%\|'' | |
463 | type a ``control d''. This is done by holding down the control | |
464 | key (usually labelled ``CTRL'') and simultaneously | |
465 | pressing the d key. This | |
466 | will end your session with \s-2UNIX\s0 and will ready the | |
467 | terminal for the next user. | |
468 | It is always important to type a ``control-d'' at the end of a session | |
469 | to make absolutely sure no one | |
470 | could accidentally stumble into your abandoned | |
471 | session and thus gain access to your files, | |
472 | tempting even the most honest of souls. | |
473 | .PP | |
474 | This is the end of the first session on \s-2UNIX\s0 text editing. | |
475 | .bp | |
476 | .ND | |
477 | .TL | |
478 | Session 2 | |
479 | .PP | |
480 | Login with \s-2UNIX\s0 as in the first session: | |
481 | .DS I 1i | |
482 | :login: \fBsusan\fP \fI(carriage return)\fR | |
483 | Password: \fI(give password and carriage return)\fR | |
484 | .if t .sp .2v | |
485 | .if n .sp 1 | |
486 | Computer Center \s-2UNIX\s0 System | |
487 | % | |
488 | .DE | |
489 | This time when you say that you want to edit, | |
490 | you can specify the name of the file you worked on last time. | |
491 | This will | |
492 | start edit working and it will fetch the contents of the | |
493 | file into the buffer, so that you can resume editing the same file. | |
494 | When edit has copied the file into the buffer, it | |
495 | will repeat its name and tell | |
496 | you the number of lines and characters it contains. | |
497 | Thus, | |
498 | .DS I 1i | |
499 | .B | |
500 | % edit text | |
501 | .R | |
502 | "text" 3 lines, 90 characters | |
503 | : | |
504 | .DE | |
505 | means you asked edit to fetch | |
506 | the file named ``text'' for editing, | |
507 | causing it to copy the | |
508 | 90 characters of text into the buffer. | |
509 | Edit awaits | |
510 | your further instructions. | |
511 | In this session, we will append more text to our file, | |
512 | print the contents of the buffer, and learn to change the text of a line. | |
513 | .SH | |
514 | Adding more text to the file | |
515 | .PP | |
516 | If you want to add more to the end of your | |
517 | text you may do so by using the append command to enter text input mode. | |
518 | Here we'll use the abbreviation for the append command, ``a'': | |
519 | .DS I 1i | |
520 | :\|\fBa | |
521 | This is text added in Session 2. | |
522 | It doesn't mean much here, but | |
523 | it does illustrate the editor. | |
524 | \&. | |
525 | .R | |
526 | .DE | |
527 | .SH | |
528 | \ \ Interrupt | |
529 | .PP | |
530 | Should you press the \s-2RUBOUT\s+2 key (sometimes labelled \s-2DELETE\s+2) | |
531 | while working with edit, | |
532 | it will send this message to you: | |
533 | .DS I 1i | |
534 | Interrupt | |
535 | : | |
536 | .DE | |
537 | Any command that edit might be executing | |
538 | is terminated by rubout or delete, | |
539 | causing edit to prompt you for a new command. | |
540 | If you are appending text at the time, | |
541 | you will exit from append mode and be expected to give another command. | |
542 | The line of text that you were typing when the append command was interrupted | |
543 | will not be entered into the buffer. | |
544 | .SH | |
545 | Making corrections | |
546 | .PP | |
547 | If you have read a general introduction to \s-2UNIX\s0, | |
548 | such as ``Communicating with \s-2UNIX\s0'', | |
549 | you will recall that it is possible to erase individual | |
550 | letters that you have typed. | |
551 | This is done by typing the designated erase character, | |
552 | usually the number sign (#), | |
553 | as many times as there are characters you want to erase. | |
554 | If you make a bad start | |
555 | in a line | |
556 | and would like to begin again, this technique | |
557 | is cumbersome \- what if you had 15 | |
558 | characters in your line and wanted to get rid of them? | |
559 | To do so either requires: | |
560 | .bd S 3 | |
561 | .DS I 1i | |
562 | .B | |
563 | This is yukky tex############### | |
564 | .R | |
565 | .DE | |
566 | with no room for the great text you'd like to type, or, | |
567 | .DS I 1i | |
568 | .B | |
569 | This is yukky tex@This is great text. | |
570 | .R | |
571 | .fl | |
572 | .bd S | |
573 | .DE | |
574 | When you type the at-sign (@), you erase | |
575 | the entire line typed so far. | |
576 | You may immediately begin to retype the line. | |
577 | This, unfortunately, does not help after you type the | |
578 | line and press carriage return. | |
579 | To make corrections in lines which have been completed, | |
580 | it is necessary to use the editing commands | |
581 | covered in this session and those that follow. | |
582 | .SH | |
583 | Listing what's in the buffer | |
584 | .PP | |
585 | Having appended text to what you wrote in Lesson 1, | |
586 | you might be curious to see what is in the buffer. | |
587 | To print the contents of the buffer, type the command: | |
588 | .DS I 1i | |
589 | :\|\fB1,$p | |
590 | .R | |
591 | .DE | |
592 | The ``1'' stands for line 1 of the buffer, | |
593 | the ``$'' is a special symbol designating the last line | |
594 | of the buffer, | |
595 | and ``p'' (or \fBprint\fR) is the command to print from line 1 | |
596 | to the end of the buffer. Thus, | |
597 | ``1,$p'' | |
598 | gives you: | |
599 | .DS I 1i | |
600 | This is some sample text. | |
601 | And thiss is some more text. | |
602 | Text editing is strange, but nice. | |
603 | This is text added in Session 2. | |
604 | It doesn't mean much here, but | |
605 | it does illustrate the editor. | |
606 | .DE | |
607 | Occasionally, you may | |
608 | enter into the buffer a character which can't be printed, | |
609 | which is done by striking a key while the \s-2CTRL\s0 key is depressed. | |
610 | In printing lines, edit uses a special notation to | |
611 | show the existence of non-printing characters. | |
612 | Suppose you had introduced the non-printing character ``control-a'' | |
613 | into the word ``illustrate'' | |
614 | by accidently holding down the \s-2CTRL\s0 key while | |
615 | typing ``a''. | |
616 | Edit would display | |
617 | .DS I 1i | |
618 | it does illustr^Ate the editor. | |
619 | .DE | |
620 | if you asked to have the line printed. | |
621 | To represent the control-a, edit shows ``^A''. | |
622 | The sequence ``^'' followed by a capital letter stands for the one character | |
623 | entered by holding down the \s-2CTRL\s0 key and typing the letter | |
624 | which appears after the ``^''. | |
625 | We'll soon discuss the commands which can be used | |
626 | to correct this typing error. | |
627 | .PP | |
628 | In looking over the text we see that | |
629 | ``this'' is typed as ``thiss'' in the second line, as suggested. | |
630 | Let's correct the spelling. | |
631 | .SH | |
632 | Finding things in the buffer | |
633 | .PP | |
634 | In order to change something in the buffer we first need to | |
635 | find it. We can find ``thiss'' in the text we have | |
636 | entered by looking at a listing | |
637 | of the lines. Physically speaking, we search the lines | |
638 | of text looking for ``thiss'' and stop searching when | |
639 | we have found it. | |
640 | The way to tell edit to search for something | |
641 | is to type it inside slash marks: | |
642 | .DS I 1i | |
643 | :\|\fB/thiss/ | |
644 | .R | |
645 | .DE | |
646 | By typing | |
647 | .B /thiss/ | |
648 | and pressing carriage return edit is | |
649 | instructed to search for ``thiss''. | |
650 | If we asked edit to look for a pattern of characters | |
651 | which it could not find in the buffer, | |
652 | it would respond ``Pattern not found''. | |
653 | When edit finds | |
654 | the characters ``thiss'', it will print the line of text | |
655 | for your inspection: | |
656 | .DS I 1i | |
657 | And thiss is some more text. | |
658 | .DE | |
659 | Edit is now positioned in the buffer at the | |
660 | line which it just printed, | |
661 | ready to make a change in the line. | |
662 | .SH | |
663 | The current line | |
664 | .PP | |
665 | At all times during an editing session, | |
666 | edit keeps track of the line in the buffer where it is positioned. | |
667 | In general, the line which has been most recently | |
668 | printed, entered, or changed | |
669 | is considered to be the current position in the buffer. | |
670 | You can refer to your current position in the buffer by the | |
671 | symbol | |
672 | period (.) usually known by the name ``dot''. | |
673 | If you type ``.'' and carriage | |
674 | return you will be instructing edit to print the current line: | |
675 | .DS I 1i | |
676 | :\|\fB\s+2\&.\s-2 | |
677 | .R | |
678 | And thiss is some more text. | |
679 | .DE | |
680 | .PP | |
681 | If you want to know the number of the current line, | |
682 | you can type | |
683 | .B \&.= | |
684 | and carriage return, | |
685 | and edit will respond with the line number: | |
686 | .DS I 1i | |
687 | :\|\fB\s+2.\s-2= | |
688 | .R | |
689 | 2 | |
690 | .DE | |
691 | If you type the number of any line and a carriage return, | |
692 | edit will | |
693 | position you at that line and | |
694 | print its contents: | |
695 | .DS I 1i | |
696 | :\|\fB2 | |
697 | .R | |
698 | And thiss is some more text. | |
699 | .DE | |
700 | You should experiment with these commands to assure | |
701 | yourself that you understand what they do. | |
702 | .SH | |
703 | Numbering lines (nu) | |
704 | .PP | |
705 | The | |
706 | .B | |
707 | number (nu) | |
708 | .R | |
709 | command is similar to print, | |
710 | giving both the number and the text of each printed line. | |
711 | To see the number and the text of the current line type | |
712 | .DS I 1i | |
713 | :\|\fBnu | |
714 | .R | |
715 | \0\0\0\0\02\0\0And thiss is some more text. | |
716 | .DE | |
717 | Notice that the shortest abbreviation for the number command is | |
718 | ``nu'' (and not ``n'' which is used for a different command). | |
719 | You may specify a range of lines | |
720 | to be listed by the number command in the same way that lines | |
721 | are specified for print. | |
722 | For example, ``1,$nu'' lists all lines in the buffer with the | |
723 | corresponding line numbers. | |
724 | .SH | |
725 | Substitute command (s) | |
726 | .PP | |
727 | Now that we have found our misspelled word it is | |
728 | time to change it from ``thiss'' to ``this''. | |
729 | As far as edit is concerned, | |
730 | changing things is a matter of | |
731 | substituting one thing for another. | |
732 | As | |
733 | .I a | |
734 | stood for | |
735 | .I append, | |
736 | so | |
737 | .I s | |
738 | stands for | |
739 | .I substitute. | |
740 | We will use the abbreviation ``s'' to reduce the chance | |
741 | of mistyping the substitute command. | |
742 | This command will instruct edit to make the change: | |
743 | .DS I 1i | |
744 | 2s/thiss/this/ | |
745 | .DE | |
746 | We first indicate the line to be changed, line 2, | |
747 | and then | |
748 | type an ``s'' to indicate we want | |
749 | substitution. | |
750 | Inside the first set of slashes | |
751 | are the characters that we want to change, | |
752 | followed by the characters to replace them | |
753 | and then a closing slash mark. | |
754 | To summarize: | |
755 | .DS I 1i | |
756 | 2s/ \fIwhat is to be changed\fR / \fIwhat to change to \fR/ | |
757 | .DE | |
758 | If edit finds an exact match of the characters to be | |
759 | changed it will make the change | |
760 | .B only | |
761 | in the first occurrence of | |
762 | the characters. | |
763 | If it does not find the characters | |
764 | to be changed it will respond: | |
765 | .DS I 1i | |
766 | Substitute pattern match failed | |
767 | .DE | |
768 | indicating your instructions could not be carried out. | |
769 | When edit does find the characters which you want to change, | |
770 | it will make the substitution and automatically print | |
771 | the changed line, so that you can check that the correct substitution | |
772 | was made. | |
773 | In the example, | |
774 | .DS I 1i | |
775 | :\|\fB2s/thiss/this/ | |
776 | .R | |
777 | And this is some more text. | |
778 | : | |
779 | .DE | |
780 | line 2 (and line 2 only) will be searched for the characters | |
781 | ``thiss'', and when the first exact match is found, ``thiss'' | |
782 | will be changed to ``this''. | |
783 | Strictly speaking, it was not necessary above to | |
784 | specify the number of the line to be changed. | |
785 | In | |
786 | .DS I 1i | |
787 | :\|\fBs/thiss/this/ | |
788 | .R | |
789 | .DE | |
790 | edit will assume that we mean to change | |
791 | the line where we are currently positioned | |
792 | (``.''). | |
793 | In this case, | |
794 | the command without a line number would have produced the same result | |
795 | because we were already positioned | |
796 | at the line we wished to change. | |
797 | .PP | |
798 | For another illustration of substitution | |
799 | we may choose the line: | |
800 | .DS I 1i | |
801 | Text editing is strange, but nice. | |
802 | .DE | |
803 | We might like to be a bit more positive. Thus, we could | |
804 | take out the characters ``strange, but\ '' so the line | |
805 | would read: | |
806 | .DS I 1i | |
807 | Text editing is nice. | |
808 | .DE | |
809 | A command which will first position edit at that line | |
810 | and then make the substitution is: | |
811 | .DS I 1i | |
812 | :\|\fB/strange/s/strange, but // | |
813 | .R | |
814 | .DE | |
815 | .PP | |
816 | What we have done here is combine our search with | |
817 | our substitution. | |
818 | Such combinations are perfectly legal. | |
819 | This illustrates that we do not necessarily have to use | |
820 | line numbers to identify a line to edit. | |
821 | Instead, we may identify the line we want to change | |
822 | by asking edit to search for a specified pattern of letters | |
823 | which occurs in that line. | |
824 | The parts of the above command are: | |
825 | .in +1i | |
826 | .TS | |
827 | .nr 35 \n(.u | |
828 | .nf | |
829 | .ds #d .d | |
830 | .if \(ts\n(.z\(ts\(ts .ds #d nl | |
831 | .nr 80 0 | |
832 | .nr 38 \w\ 2\f3/strange/\fP\ 2 | |
833 | .if \n(80<\n(38 .nr 80 \n(38 | |
834 | .nr 38 \w\ 2\f3s\fP\ 2 | |
835 | .if \n(80<\n(38 .nr 80 \n(38 | |
836 | .nr 38 \w\ 2\f3/strange, but //\fP\ 2 | |
837 | .if \n(80<\n(38 .nr 80 \n(38 | |
838 | .nr 81 0 | |
839 | .nr 38 \w\ 2tells edit to find the characters ``strange'' in the text\ 2 | |
840 | .if \n(81<\n(38 .nr 81 \n(38 | |
841 | .nr 38 \w\ 2tells edit we want to make a substitution\ 2 | |
842 | .if \n(81<\n(38 .nr 81 \n(38 | |
843 | .nr 38 \w\ 2substitutes nothing at all for the characters ``strange, but ''\ 2 | |
844 | .if \n(81<\n(38 .nr 81 \n(38 | |
845 | .nr 38 1n | |
846 | .nr 79 0 | |
847 | .nr 40 \n(79+(0*\n(38) | |
848 | .nr 80 +\n(40 | |
849 | .nr 41 \n(80+(3*\n(38) | |
850 | .nr 81 +\n(41 | |
851 | .nr TW \n(81 | |
852 | .if t .if (\n(TW+\n(.o)>7.75i .tm Table at line 307 file ed2.tbl is too wide - \n(TW units | |
853 | .fc \ 2 \ 3 | |
854 | .nr #T 0 | |
855 | .eo | |
856 | .de T# | |
857 | .ds #d .d | |
858 | .if \(ts\n(.z\(ts\(ts .ds #d nl | |
859 | .mk ## | |
860 | .nr ## -1v | |
861 | .. | |
862 | .ec | |
863 | .ta \n(80u \n(81u | |
864 | \&\h'|\n(40u'\ 2\f3/strange/\fP\ 3\ 2\h'|\n(41u'\ 2tells edit to find the characters ``strange'' in the text\ 3\ 2 | |
865 | .ta \n(80u \n(81u | |
866 | \&\h'|\n(40u'\ 2\f3s\fP\ 3\ 2\h'|\n(41u'\ 2tells edit we want to make a substitution\ 3\ 2 | |
867 | .ta \n(80u \n(81u | |
868 | \&\h'|\n(40u'\ 2\f3/strange, but //\fP\ 3\ 2\h'|\n(41u'\ 2substitutes nothing at all for the characters ``strange, but ''\ 3\ 2 | |
869 | .fc | |
870 | .nr T. 1 | |
871 | .T# 1 | |
872 | .if \n(35>0 .fi | |
873 | .TE | |
874 | .in -1i | |
875 | .PP | |
876 | You should note the space after ``but'' in ``/strange, but /''. | |
877 | If you do not indicate the space is to be taken out, | |
878 | your line will be: | |
879 | .DS I 1i | |
880 | .if t Text editing is nice. | |
881 | .if n Text editing is nice. | |
882 | .DE | |
883 | which looks a little funny | |
884 | because of the extra space between ``is'' and ``nice''. | |
885 | Again, we realize from this that a blank space | |
886 | is a real character to a computer, and in editing text | |
887 | we need to be aware of spaces | |
888 | within a line just as we would be aware of an ``a'' or | |
889 | a ``4''. | |
890 | .SH | |
891 | Another way to list what's in the buffer (z) | |
892 | .PP | |
893 | Although the print command is useful for looking at specific lines | |
894 | in the buffer, | |
895 | other commands can be more convenient for | |
896 | viewing large sections of text. | |
897 | You can ask to see a screen full of text at a time | |
898 | by using the command | |
899 | .B z. | |
900 | If you type | |
901 | .DS I 1i | |
902 | :\|\fB1z | |
903 | .R | |
904 | .DE | |
905 | edit will start with line 1 and continue printing lines, | |
906 | stopping either when the screen of | |
907 | your terminal is full | |
908 | or when the last line in the buffer has been printed. | |
909 | If you want to read the next segment of text, give the command | |
910 | .DS I 1i | |
911 | :\|\fBz | |
912 | .DE | |
913 | If no starting line number is given for the z command, | |
914 | printing will start at the ``current'' line, in this case the | |
915 | last line printed. | |
916 | Viewing lines in the buffer one screen full at a time | |
917 | is known as paging. | |
918 | Paging can also be used to print a section of text on a hard-copy terminal. | |
919 | .SH | |
920 | Saving the modified text | |
921 | .PP | |
922 | This seems to be a good place to pause in our work, | |
923 | and so we should end the second session. | |
924 | If you (in haste) type ``q'' to quit the session | |
925 | your dialogue with edit will be: | |
926 | .DS I 1i | |
927 | :\|\fBq | |
928 | .R | |
929 | No write since last change (q! quits) | |
930 | : | |
931 | .DE | |
932 | This is edit's warning that you have not written | |
933 | the modified contents of the buffer to disk. | |
934 | You run the risk of losing the work you have done | |
935 | during the editing session since the latest write | |
936 | command. Since in this lesson we have not written | |
937 | to disk at all, everything we have done | |
938 | would be lost. | |
939 | If we did not want to save the work done during | |
940 | this editing session, we would have to type ``q!'' | |
941 | to confirm that we indeed wanted to end the session | |
942 | immediately, losing the contents of the buffer. | |
943 | However, | |
944 | since we want to preserve what | |
945 | we have edited, we need to say: | |
946 | .DS I 1i | |
947 | :\|\fBw | |
948 | .R | |
949 | "text" 6 lines, 171 characters | |
950 | .DE | |
951 | and then, | |
952 | .DS I 1i | |
953 | :\|\fBq | |
954 | % \fI{control d}\fR | |
955 | .DE | |
956 | and hang up the phone or turn off the terminal when | |
957 | \s-2UNIX\s0 asks for a name. | |
958 | This is the end of the second session on \s-2UNIX\s0 text editing. | |
959 | .bp | |
960 | .ND | |
961 | .TL | |
962 | Session 3 | |
963 | .SH | |
964 | Bringing text into the buffer (e) | |
965 | .PP | |
966 | Login to \s-2UNIX\s0 and make contact with edit. | |
967 | You should try to login without | |
968 | looking at the notes, but if you must | |
969 | then by all means do. | |
970 | .PP | |
971 | Did you remember to give the name of the file | |
972 | you wanted to edit? That is, did you say | |
973 | .DS I 1i | |
974 | % \fBedit text\fR | |
975 | .DE | |
976 | or simply | |
977 | .DS I 1i | |
978 | % \fBedit\fR | |
979 | .DE | |
980 | Both ways get you in contact with edit, but the first way | |
981 | will bring a copy of the file named ``text'' into | |
982 | the buffer. | |
983 | If you did forget to tell edit the name of your file, | |
984 | you can get it into the buffer by | |
985 | saying: | |
986 | .DS I 1i | |
987 | :\|\fBe text | |
988 | .R | |
989 | "text" 6 lines, 171 characters | |
990 | .DE | |
991 | The command | |
992 | .B edit, | |
993 | which may be abbreviated ``\fBe\fR'', | |
994 | tells edit that you want | |
995 | to erase anything that might already be in | |
996 | the buffer and bring a copy of the file ``text'' into the buffer | |
997 | for editing. | |
998 | You may also use the edit (e) command to change files in | |
999 | the middle of an editing session | |
1000 | or to give edit the name of a new file that you want to create. | |
1001 | Because the edit command clears the buffer, | |
1002 | you will receive a warning if you try to edit a new file without | |
1003 | having saved a copy of the old file. | |
1004 | This gives you a chance to write the contents of the buffer to disk | |
1005 | before editing the next file. | |
1006 | .SH | |
1007 | Moving text in the buffer (m) | |
1008 | .PP | |
1009 | Edit allows you to move lines of text | |
1010 | from one location in the buffer to another | |
1011 | by means of the | |
1012 | .B move | |
1013 | (\fBm\fR) command: | |
1014 | .DS I 1i | |
1015 | :\|\fB2,4m$ | |
1016 | .R | |
1017 | .DE | |
1018 | This command directs edit to move lines 2, 3, and 4 | |
1019 | to the end of the buffer ($). | |
1020 | The format for the move command is that you specify | |
1021 | the first line to be moved, the last line to be moved, | |
1022 | the move command ``m'', and the line after which | |
1023 | the moved text is to be placed. | |
1024 | Thus, | |
1025 | .DS I 1i | |
1026 | :\|\fB1,6m20 | |
1027 | .R | |
1028 | .DE | |
1029 | would instruct edit to move lines 1 through 6 (inclusive) | |
1030 | to a position after line 20 in the buffer. | |
1031 | To move only one line, say, line 4, | |
1032 | to a position in the buffer after line 6, | |
1033 | the command would be ``4m6''. | |
1034 | .PP | |
1035 | Let's move some text using the command: | |
1036 | .DS I 1i | |
1037 | :\|\fB5,$m1 | |
1038 | .R | |
1039 | 2 lines moved | |
1040 | it does illustrate the editor. | |
1041 | .DE | |
1042 | After executing a command which changes more than one line of the buffer, | |
1043 | edit tells how many lines were affected by the change. | |
1044 | The last moved line is printed for your inspection. | |
1045 | If you want to see more than just the last line, | |
1046 | use the print (p), z, or number (nu) command to view more text. | |
1047 | The buffer should now contain: | |
1048 | .DS I 1i | |
1049 | This is some sample text. | |
1050 | It doesn't mean much here, but | |
1051 | it does illustrate the editor. | |
1052 | And this is some more text. | |
1053 | Text editing is nice. | |
1054 | This is text added in Session 2. | |
1055 | .DE | |
1056 | We can restore the original order by typing: | |
1057 | .DS I 1i | |
1058 | :\|\fB4,$m1 | |
1059 | .R | |
1060 | .DE | |
1061 | or, combining context searching and the move command: | |
1062 | .DS I 1i | |
1063 | :\|\fB/And this is some/,/This is text/m/This is some sample/ | |
1064 | .R | |
1065 | .DE | |
1066 | The problem with combining context searching | |
1067 | with the move command | |
1068 | is that the chance of making a typing error | |
1069 | in such a long command is greater than | |
1070 | if one types line numbers. | |
1071 | .SH | |
1072 | Copying lines (copy) | |
1073 | .PP | |
1074 | The | |
1075 | .B copy | |
1076 | command | |
1077 | is used to make a second copy of specified lines, | |
1078 | leaving the original lines where they were. | |
1079 | Copy | |
1080 | has the same format as the move command, for example: | |
1081 | .DS I 1i | |
1082 | :\|\fB12,15copy $ | |
1083 | .R | |
1084 | .DE | |
1085 | makes a copy of lines 12 through 15, | |
1086 | placing the added lines after the buffer's end ($). | |
1087 | Experiment with the copy command | |
1088 | so that you can become familiar with how it works. | |
1089 | Note that the shortest abbreviation for copy is | |
1090 | ``co'' (and | |
1091 | .B not | |
1092 | the letter ``c'' which has another meaning). | |
1093 | .SH | |
1094 | Deleting lines (d) | |
1095 | .PP | |
1096 | Suppose you want to delete | |
1097 | the line | |
1098 | .DS I 1i | |
1099 | This is text added in Session 2. | |
1100 | .DE | |
1101 | from the buffer. | |
1102 | If you know the number of the line to be deleted, | |
1103 | you can type | |
1104 | that number followed by | |
1105 | ``\fBdelete\fR'' or ``\fBd\fR''. | |
1106 | This example deletes line 4: | |
1107 | .DS I 1i | |
1108 | :\|\fB4d | |
1109 | .R | |
1110 | It doesn't mean much here, but | |
1111 | .DE | |
1112 | Here ``4'' is the number of the line to be deleted and | |
1113 | ``delete'' or ``d'' is the command to delete the line. | |
1114 | After executing the delete command, | |
1115 | edit prints the line which has become the current line (``.''). | |
1116 | .PP | |
1117 | If you do not happen to know the line number | |
1118 | you can search for the line and then delete it using this | |
1119 | sequence of commands: | |
1120 | .DS I 1i | |
1121 | :\|\fB/added in Session 2./ | |
1122 | .R | |
1123 | This is text added in Session 2. | |
1124 | :\|\fBd | |
1125 | .R | |
1126 | It doesn't mean much here, but | |
1127 | .DE | |
1128 | The ``/added in Session 2./'' | |
1129 | asks edit to locate and print | |
1130 | the next line which contains the indicated text. | |
1131 | Once you are sure that you have correctly specified the line that | |
1132 | you want to delete, | |
1133 | you can enter the delete (d) command. | |
1134 | In this case it is not necessary to | |
1135 | specify a line number before the ``d''. | |
1136 | If no line number is given, | |
1137 | edit deletes the current line (``.''), | |
1138 | that is, the line found by our search. | |
1139 | After the deletion, your buffer should contain: | |
1140 | .DS I 1i | |
1141 | This is some sample text. | |
1142 | And this is some more text. | |
1143 | Text editing is nice. | |
1144 | It doesn't mean much here, but | |
1145 | it does illustrate the editor. | |
1146 | .DE | |
1147 | To delete both lines 2 and 3: | |
1148 | .DS I 1i | |
1149 | And this is some more text. | |
1150 | Text editing is nice. | |
1151 | .DE | |
1152 | you type | |
1153 | .DS I 1i | |
1154 | :\|\fB2,3d | |
1155 | .R | |
1156 | .DE | |
1157 | which specifies the range of lines from 2 to 3, | |
1158 | and the operation on those lines \- ``d'' for delete. | |
1159 | .PP | |
1160 | Again, this presumes that you know the line numbers for | |
1161 | the lines to be deleted. | |
1162 | If you do not you might combine the search command | |
1163 | with the delete command as so: | |
1164 | .DS I 1i | |
1165 | :\|\fB/And this is some/,/Text editing is nice./d | |
1166 | .R | |
1167 | .DE | |
1168 | .SH | |
1169 | A word or two of caution: | |
1170 | .PP | |
1171 | In using the search function to locate lines to | |
1172 | be deleted you should be | |
1173 | .B | |
1174 | absolutely sure | |
1175 | .R | |
1176 | the characters you give as the basis for the search | |
1177 | will take edit to the line you want deleted. | |
1178 | Edit will search for the first | |
1179 | occurrence of the characters starting from where | |
1180 | you last edited \- | |
1181 | that is, from the line you see printed if you type dot (.). | |
1182 | .PP | |
1183 | A search based on too few | |
1184 | characters may result in the wrong lines being deleted, | |
1185 | which edit will do as easily as if you had meant it. | |
1186 | For this reason, it is usually safer | |
1187 | to specify the search and then delete in two separate steps, | |
1188 | at least until you become familiar enough with using the editor | |
1189 | that you understand how best to specify searches. | |
1190 | For a beginner it is not a bad idea to double-check | |
1191 | each command before pressing carriage return to send the command on its way. | |
1192 | .SH | |
1193 | Undo (u) to the rescue | |
1194 | .PP | |
1195 | The | |
1196 | .B | |
1197 | undo (u) | |
1198 | .R | |
1199 | command has the ability to | |
1200 | reverse the effects of the last command. | |
1201 | To undo the previous command, type | |
1202 | ``u'' or ``undo''. | |
1203 | Undo can rescue | |
1204 | the contents of the buffer from many an unfortunate mistake. | |
1205 | However, its powers are not unlimited, | |
1206 | so it is still wise to be reasonably careful about the commands you give. | |
1207 | It is possible to undo only commands which | |
1208 | have the power to change the buffer, for example | |
1209 | delete, append, move, copy, substitute, and even undo itself. | |
1210 | The commands write (w) and edit (e) which interact with disk files | |
1211 | cannot be undone, nor can commands such as print which do not change | |
1212 | the buffer. | |
1213 | Most importantly, | |
1214 | the | |
1215 | .B only | |
1216 | command which can be reversed by undo | |
1217 | is the | |
1218 | last ``undo-able'' command which you gave. | |
1219 | .PP | |
1220 | To illustrate, | |
1221 | let's issue an undo command. | |
1222 | Recall that the last buffer-changing command we gave deleted | |
1223 | the lines which were formerly numbered 2 and 3. | |
1224 | Executing undo at this moment will reverse the effects | |
1225 | of the deletion, causing those two lines to be | |
1226 | replaced in the buffer. | |
1227 | .DS I 1i | |
1228 | :\|\fBu | |
1229 | .R | |
1230 | 2 more lines in file after undo | |
1231 | And this is some more text. | |
1232 | .DE | |
1233 | Here again, edit informs you if the command affects more | |
1234 | than one line, | |
1235 | and prints | |
1236 | the text of the line which is now ``dot'' (the current line). | |
1237 | .SH | |
1238 | More about the dot (.) and buffer end ($) | |
1239 | .PP | |
1240 | The function assumed by the symbol dot depends on its context. | |
1241 | It can be used: | |
1242 | .IP | |
1243 | 1. to exit from append mode we type dot (and only a dot) on | |
1244 | a line and press carriage return; | |
1245 | .IP | |
1246 | 2. to refer to the line we are at in the buffer. | |
1247 | .LP | |
1248 | Dot can also be combined with the equal sign to get | |
1249 | the number of the line currently being edited: | |
1250 | .DS I 1i | |
1251 | :\|\fB\&.= | |
1252 | .R | |
1253 | .DE | |
1254 | Thus if we type ``\fB.\fR='' we are asking for the number of the line | |
1255 | and if we type ``\fB.\fR'' we are asking for the text of the line. | |
1256 | .PP | |
1257 | In this editing session and the last, we used the dollar | |
1258 | sign to indicate the end of the buffer | |
1259 | in commands such as print, copy, and move. | |
1260 | The dollar sign as a command asks edit to print the last | |
1261 | line in the buffer. | |
1262 | If the dollar sign is combined with the equal sign ($=) | |
1263 | edit will print the line number corresponding to the | |
1264 | last line in the buffer. | |
1265 | .PP | |
1266 | ``\fB.\fR'' and ``$'' therefore represent line numbers. | |
1267 | Whenever appropriate, these symbols can be used in | |
1268 | place of line numbers in commands. | |
1269 | For example | |
1270 | .DS I 1i | |
1271 | :\|\fB\s+2.\s-2,$d | |
1272 | .R | |
1273 | .DE | |
1274 | instructs edit to delete all lines from the current line (\fB.\fR) | |
1275 | to the end of the buffer. | |
1276 | .SH | |
1277 | Moving around in the buffer (+ and \-) | |
1278 | .PP | |
1279 | It is frequently convenient during an editing session | |
1280 | to go back and re-read a previous line. | |
1281 | We could specify a context search for a line we want to | |
1282 | read if we remember some of its text, | |
1283 | but if we simply want to see what was written a few, say 3, lines | |
1284 | ago, we can type | |
1285 | .DS I 1i | |
1286 | \-3p | |
1287 | .DE | |
1288 | This tells edit to move back to a position 3 lines | |
1289 | before the current line (.) | |
1290 | and print that line. | |
1291 | We can move forward in the buffer similarly: | |
1292 | .DS I 1i | |
1293 | +2p | |
1294 | .DE | |
1295 | instructs edit to print the line which is 2 | |
1296 | ahead of our current position. | |
1297 | .PP | |
1298 | You may use ``+'' and ``\-'' in any command where edit | |
1299 | accepts line numbers. | |
1300 | Line numbers specified with ``+'' or ``\-'' | |
1301 | can be combined to print a range of lines. | |
1302 | The command | |
1303 | .DS I 1i | |
1304 | :\|\fB\-1,+2copy$ | |
1305 | .R | |
1306 | .DE | |
1307 | makes a copy of 4 lines: the current line, the line before it, | |
1308 | and the two after it. | |
1309 | The copied lines will be placed after the last line | |
1310 | in the buffer ($). | |
1311 | .PP | |
1312 | Try typing only ``\-''; you will move back one line just as | |
1313 | if you had typed ``\-1p''. | |
1314 | Typing the command ``+'' works similarly. | |
1315 | You might also try typing a few plus or minus signs in a row | |
1316 | (such as ``+++'') to see edit's response. | |
1317 | Typing a carriage return alone on a line is the equivalent | |
1318 | of typing ``+1p''; it will move you one line ahead in the buffer | |
1319 | and print that line. | |
1320 | .PP | |
1321 | If you are at the last line of the buffer and try | |
1322 | to move further ahead, perhaps by typing a ``+'' or | |
1323 | a carriage return alone on the line, | |
1324 | edit will remind you that you are at the end of the buffer: | |
1325 | .DS I 1i | |
1326 | At end-of-file | |
1327 | .DE | |
1328 | Similarly, if you try to move to a position before the first line, | |
1329 | edit will print one of these messages: | |
1330 | .DS I 1i | |
1331 | Nonzero address required on this command | |
1332 | Negative address \- first buffer line is 1 | |
1333 | .DE | |
1334 | The number associated with a buffer line is the line's ``address'', | |
1335 | in that it can be used to locate the line. | |
1336 | .SH | |
1337 | Changing lines (c) | |
1338 | .PP | |
1339 | There may be occasions when you want to delete certain lines and | |
1340 | insert new text in their place. | |
1341 | This can be accomplished easily with the | |
1342 | .B "change (c)" | |
1343 | command. | |
1344 | The change command instructs edit to delete specified lines | |
1345 | and then switch to text input mode in order to | |
1346 | accept the text which will replace them. | |
1347 | Let's say we want to change the first two lines in the buffer: | |
1348 | .DS I 1i | |
1349 | This is some sample text. | |
1350 | And this is some more text. | |
1351 | .DE | |
1352 | to read | |
1353 | .DS I 1i | |
1354 | This text was created with the \s-2UNIX\s0 text editor. | |
1355 | .DE | |
1356 | To do so, you can type: | |
1357 | .DS I 1i | |
1358 | :\|\fB1,2c | |
1359 | .R | |
1360 | 2 lines changed | |
1361 | .B | |
1362 | This text was created with the \s-2UNIX\s0 text editor. | |
1363 | \s+2\&.\s-2 | |
1364 | .R | |
1365 | : | |
1366 | .DE | |
1367 | In the command | |
1368 | .B 1,2c | |
1369 | we specify that we want to change | |
1370 | the range of lines beginning with 1 and ending with 2 | |
1371 | by giving line numbers as with the print command. | |
1372 | These lines will be deleted. | |
1373 | After a carriage return enters the change command, | |
1374 | edit notifies you if more than one line will be changed | |
1375 | and places you in text input mode. | |
1376 | Any text typed on the following lines will be inserted into | |
1377 | the position where lines were deleted by the change command. | |
1378 | You will remain in text input mode until you exit in the usual way, | |
1379 | by typing a period alone on a line. | |
1380 | Note that the number of lines added to the buffer need not be | |
1381 | the same as the number of lines deleted. | |
1382 | .sp 1 | |
1383 | .PP | |
1384 | This is the end of the third session on text editing with \s-2UNIX\s0. | |
1385 | .bp | |
1386 | .ND | |
1387 | .TL | |
1388 | Session 4 | |
1389 | .PP | |
1390 | This lesson covers several topics, starting with | |
1391 | commands which apply throughout the buffer, | |
1392 | characters with special meanings, | |
1393 | and how to issue \s-2UNIX\s0 commands while in the editor. | |
1394 | The next topics deal with files: | |
1395 | more on reading and writing, | |
1396 | and methods of recovering files lost in a crash. | |
1397 | The final section suggests sources of further information. | |
1398 | .SH | |
1399 | Making commands global (g) | |
1400 | .PP | |
1401 | One disadvantage to the commands we have used for | |
1402 | searching or substituting is that if you | |
1403 | have a number of instances of a word to change | |
1404 | it appears that you have to type the command | |
1405 | repeatedly, once for | |
1406 | each time the change needs to be made. | |
1407 | Edit, however, provides a way to make commands | |
1408 | apply to the entire contents of the buffer \- | |
1409 | the | |
1410 | .B | |
1411 | global (g) | |
1412 | .R | |
1413 | command. | |
1414 | .PP | |
1415 | To print all lines | |
1416 | containing a certain sequence of characters | |
1417 | (say, ``text'') | |
1418 | the command is: | |
1419 | .DS I 1i | |
1420 | :\|\fBg/text/p | |
1421 | .R | |
1422 | .DE | |
1423 | The ``g'' instructs edit to | |
1424 | make a global search for all lines | |
1425 | in the buffer containing the characters ``text''. | |
1426 | The ``p'' prints the lines found. | |
1427 | .PP | |
1428 | To issue a global command, start by typing a ``g'' and then a search | |
1429 | pattern identifying | |
1430 | the lines to be affected. | |
1431 | Then, on the same line, type the command to be | |
1432 | executed on the identified lines. | |
1433 | Global substitutions are frequently useful. | |
1434 | For example, | |
1435 | to change all instances of the word ``text'' to the word ``material'' | |
1436 | the command would be a combination of the global search and the | |
1437 | substitute command: | |
1438 | .DS I 1i | |
1439 | :\|\fBg/text/s/text/material/g | |
1440 | .R | |
1441 | .DE | |
1442 | Note the ``g'' at the end of the global command | |
1443 | which instructs edit to change | |
1444 | each and every instance of ``text'' to ``material''. | |
1445 | If you do not type the ``g'' at the end of the command | |
1446 | only the | |
1447 | .I first | |
1448 | instance of ``text'' in each line will be changed | |
1449 | (the normal result of the substitute command). | |
1450 | The ``g'' at the end of the command is independent of the ``g'' | |
1451 | at the beginning. | |
1452 | You may give a command such as: | |
1453 | .DS I 1i | |
1454 | :\|\fB14s/text/material/g | |
1455 | .R | |
1456 | .DE | |
1457 | to change every instance of ``text'' in line 14 alone. | |
1458 | Further, neither command will change ``Text'' to ``material'' | |
1459 | because ``Text'' begins with a capital rather than a lower-case | |
1460 | .I t. | |
1461 | .PP | |
1462 | Edit does not automatically print the lines modified by a | |
1463 | global command. | |
1464 | If you want the lines to be printed, type a ``p'' | |
1465 | at the end of the global command: | |
1466 | .DS I 1i | |
1467 | :\|\fBg/text/s/text/material/gp | |
1468 | .R | |
1469 | .DE | |
1470 | The usual qualification should be made | |
1471 | about using the global command in combination with any other \- | |
1472 | in essence, be sure of what you are telling edit to do | |
1473 | to the entire buffer. For example, | |
1474 | .DS I 1i | |
1475 | :\|\fBg/ /d | |
1476 | .R | |
1477 | 72 less lines in file after global | |
1478 | .DE | |
1479 | will delete every line containing a blank anywhere in it. | |
1480 | This could adversely affect | |
1481 | your document, since most lines have spaces between words | |
1482 | and thus would be deleted. | |
1483 | After executing the global command, | |
1484 | edit will print a warning if the command added or deleted more than one line. | |
1485 | Fortunately, the undo command can reverse | |
1486 | the effects of a global command. | |
1487 | You should experiment with the global command | |
1488 | on a small buffer of text to see what it can do for you. | |
1489 | .SH | |
1490 | More about searching and substituting | |
1491 | .PP | |
1492 | In using slashes to identify a character string | |
1493 | that we want to search for or change, | |
1494 | we have always specified the exact characters. | |
1495 | There is a less tedious way to | |
1496 | repeat the same string of characters. | |
1497 | To change ``noun'' to ``nouns'' we may type either | |
1498 | .DS I 1i | |
1499 | :\|\fB/noun/s/noun/nouns/ | |
1500 | .R | |
1501 | .DE | |
1502 | as we have done in the past, | |
1503 | or a somewhat abbreviated command: | |
1504 | .DS I 1i | |
1505 | :\|\fB/noun/s//nouns/ | |
1506 | .R | |
1507 | .DE | |
1508 | In this example, the characters to be changed | |
1509 | are not specified \- | |
1510 | there are no characters, not even a space, | |
1511 | between the two slash marks which indicate what is to be changed. | |
1512 | This lack of characters between the slashes is taken by the editor to mean | |
1513 | ``use the characters we last searched for as the characters to be changed.'' | |
1514 | .PP | |
1515 | Similarly, the last context search may be repeated | |
1516 | by typing a pair of slashes with nothing between them: | |
1517 | .DS I 1i | |
1518 | :\|\fB/does/ | |
1519 | .R | |
1520 | It doesn't mean much here, but | |
1521 | :\|\fB// | |
1522 | .R | |
1523 | it does illustrate the editor. | |
1524 | .DE | |
1525 | Because no characters are specified for the second search, | |
1526 | the editor scans the buffer for the next occurrence of the | |
1527 | characters ``does''. | |
1528 | .PP | |
1529 | Edit normally searches forward through the buffer, | |
1530 | wrapping around from the end of the buffer to the beginning, | |
1531 | until the specified character string is found. | |
1532 | If you want to search in the reverse direction, | |
1533 | use question marks (?) instead of slashes | |
1534 | to surround the character string. | |
1535 | .SH | |
1536 | Special characters | |
1537 | .PP | |
1538 | Two characters have special meanings when | |
1539 | used in specifying searches: ``$'' and ``^''. | |
1540 | ``$'' is taken by the editor to mean ``end of the line'' | |
1541 | and is used to identify strings | |
1542 | which occur at the end of a line. | |
1543 | .DS I 1i | |
1544 | :\|\fBg/ing$/s//ed/p | |
1545 | .R | |
1546 | .DE | |
1547 | tells the editor to search for all lines ending in ``ing'' | |
1548 | (and nothing else, not even a blank space), | |
1549 | to change each final ``ing'' to ``ed'' | |
1550 | and print the changed lines. | |
1551 | .PP | |
1552 | The symbol ``^'' indicates the beginning of a line. | |
1553 | Thus, | |
1554 | .DS I 1i | |
1555 | :\|\fBs/^/1. / | |
1556 | .R | |
1557 | .DE | |
1558 | instructs the editor to insert ``1.'' and a space at the beginning | |
1559 | of the current line. | |
1560 | .PP | |
1561 | The characters ``$'' and ``^'' have special meanings only in the context | |
1562 | of searching. | |
1563 | At other times, they are ordinary characters. | |
1564 | If you ever need to search for a character that has a special meaning, | |
1565 | you must indicate that the | |
1566 | character is to temporarily lose | |
1567 | its special significance by typing another special character, | |
1568 | the backslash (\\), before it. | |
1569 | .DS I 1i | |
1570 | :\|\fBs/\\\\\&$/dollar/ | |
1571 | .R | |
1572 | .DE | |
1573 | looks for the character ``$'' in the current | |
1574 | line and replaces it by the word ``dollar''. | |
1575 | Were it not for the backslash, the ``$'' would have represented | |
1576 | ``the end of the line'' in your search, | |
1577 | not necessarily the character ``$''. | |
1578 | The backslash retains its special significance at all times. | |
1579 | .SH | |
1580 | Issuing \s-2UNIX\s0 commands from the editor | |
1581 | .PP | |
1582 | After creating several files with the editor, | |
1583 | you may want to delete files | |
1584 | no longer useful to you or ask for a list of your files. | |
1585 | Removing and listing files are not functions of the editor, | |
1586 | and so they require the use of \s-2UNIX\s0 system commands | |
1587 | (also referred to as ``shell'' commands, as | |
1588 | ``shell'' is the name of the program that processes \s-2UNIX\s0 commands). | |
1589 | You do not need to quit the editor to execute a \s-2UNIX\s0 command | |
1590 | as long as you indicate that it | |
1591 | is to be sent to the shell for execution. | |
1592 | To use the \s-2UNIX\s0 command | |
1593 | .I rm | |
1594 | to remove the file named ``junk'' type: | |
1595 | .DS I 1i | |
1596 | :\|\fB!rm junk | |
1597 | .R | |
1598 | ! | |
1599 | : | |
1600 | .DE | |
1601 | The exclamation mark (!) | |
1602 | indicates that the rest of the line is to be processed as a \s-2UNIX\s0 command. | |
1603 | If the buffer contents have not been written since the last change, | |
1604 | a warning will be printed before the command is executed. | |
1605 | The editor prints a ``!'' when the command is completed. | |
1606 | The tutorial ``Communicating with \s-2UNIX\s0'' | |
1607 | describes useful features of the system, | |
1608 | of which the editor is only one part. | |
1609 | .SH | |
1610 | Filenames and file manipulation | |
1611 | .PP | |
1612 | Throughout each editing session, | |
1613 | edit keeps track of the name of the file being edited as the | |
1614 | .I "current filename." | |
1615 | Edit remembers as the current filename the name given | |
1616 | when you entered the editor. | |
1617 | The current filename changes whenever the edit (e) command | |
1618 | is used to specify a new file. | |
1619 | Once edit has recorded a current filename, | |
1620 | it inserts that name into any command where a filename has been omitted. | |
1621 | If a write command does not specify a file, | |
1622 | edit, as we have seen, supplies the current filename. | |
1623 | You can have the editor write onto a different file | |
1624 | by including its name in the write command: | |
1625 | .DS I 1i | |
1626 | :\fB\|w chapter3 | |
1627 | .R | |
1628 | "chapter3" 283 lines, 8698 characters | |
1629 | .DE | |
1630 | The current filename remembered by the editor | |
1631 | .I | |
1632 | will not be changed as a result of the write command | |
1633 | unless it is the first filename given in the editing session. | |
1634 | .R | |
1635 | Thus, in the next write command | |
1636 | which does not specify a name, | |
1637 | edit will write onto the current file and not onto the file ``chapter3''. | |
1638 | .SH | |
1639 | The file (f) command | |
1640 | .PP | |
1641 | To ask for the current filename, type | |
1642 | .B file | |
1643 | (or | |
1644 | .B f ). | |
1645 | In response, the editor provides current information about the buffer, | |
1646 | including the filename, your current position, and the number of | |
1647 | lines in the buffer: | |
1648 | .DS I 1i | |
1649 | :\|\fBf | |
1650 | .R | |
1651 | "text" [Modified] line 3 of 4 --75%-- | |
1652 | .DE | |
1653 | .\"The expression ``[Edited]'' indicates that the buffer contains | |
1654 | .\"either the editor's copy of the existing file ``text'' | |
1655 | .\"or a file which you are just now creating. | |
1656 | If the contents of the buffer have changed | |
1657 | since the last time the file was written, | |
1658 | the editor will tell you that the file has been ``[Modified]''. | |
1659 | After you save the changes by writing onto a disk file, | |
1660 | the buffer will no longer be considered modified: | |
1661 | .DS I 1i | |
1662 | :\|\fBw | |
1663 | .R | |
1664 | "text" 4 lines, 88 characters | |
1665 | :\|\fBf | |
1666 | .R | |
1667 | "text" line 3 of 4 --75%-- | |
1668 | .DE | |
1669 | .SH | |
1670 | Reading additional files (r) | |
1671 | ||
1672 | .PP | |
1673 | The | |
1674 | .B | |
1675 | read (r) | |
1676 | .R | |
1677 | command allows you to add the contents of a file | |
1678 | to the buffer | |
1679 | without destroying the text already there. | |
1680 | To use it, specify the line after which the new text will be placed, | |
1681 | the command | |
1682 | .I r, | |
1683 | and then the name of the file. | |
1684 | .DS I 1i | |
1685 | :\|\fB$r bibliography | |
1686 | .R | |
1687 | "bibliography" 18 lines, 473 characters | |
1688 | .DE | |
1689 | This command reads in the file | |
1690 | .I bibliography | |
1691 | and adds it to the buffer after the last line. | |
1692 | The current filename is not changed by the read command unless | |
1693 | it is the first filename given in the editing session. | |
1694 | .SH | |
1695 | Writing parts of the buffer | |
1696 | .PP | |
1697 | The | |
1698 | .B | |
1699 | write (w) | |
1700 | .R | |
1701 | command can write all or part of the buffer | |
1702 | to a file you specify. | |
1703 | We are already familiar with | |
1704 | writing the entire contents of the | |
1705 | buffer to a disk file. | |
1706 | To write only part of the buffer onto a file, | |
1707 | indicate the beginning and ending lines before the write command, | |
1708 | for example | |
1709 | .DS I 1i | |
1710 | :\|\fB45,$w ending | |
1711 | .R | |
1712 | .DE | |
1713 | Here all lines from 45 through the end of the buffer | |
1714 | are written onto the file named | |
1715 | .I ending. | |
1716 | The lines remain in the buffer | |
1717 | as part of the document you are editing, | |
1718 | and you may continue to edit the entire buffer. | |
1719 | .SH | |
1720 | Recovering files | |
1721 | .PP | |
1722 | Under most circumstances, | |
1723 | edit's crash recovery mechanism | |
1724 | is able to save work to within a few lines of changes | |
1725 | after a crash or if the phone is hung up accidently. | |
1726 | If you lose the contents of an editing buffer in a system crash, | |
1727 | you will normally receive mail when you login which gives | |
1728 | the name of the recovered file. | |
1729 | To recover the file, | |
1730 | enter the editor and type the command | |
1731 | .B recover | |
1732 | (\fBrec\fR), | |
1733 | followed by the name of the lost file. | |
1734 | .DS I 1i | |
1735 | .R | |
1736 | :\|\fBrecover chap6 | |
1737 | .R | |
1738 | .DE | |
1739 | Recover is sometimes unable to save the entire buffer successfully, | |
1740 | so always check the contents of the saved buffer carefully | |
1741 | before writing it back onto the original file. | |
1742 | .SH | |
1743 | Other recovery techniques | |
1744 | .PP | |
1745 | If something goes wrong when you are using the editor, | |
1746 | it may be possible to save your work by using the command | |
1747 | .B preserve | |
1748 | (\fBpre\fR), | |
1749 | which saves the buffer as if the system had crashed. | |
1750 | If you are writing a file and you get the message | |
1751 | ``Quota exceeded'', you have tried to use more disk storage | |
1752 | than is allotted to your account. | |
1753 | .I | |
1754 | Proceed with caution | |
1755 | .R | |
1756 | because it is likely that only a part | |
1757 | of the editor's buffer is now present in the file you tried to write. | |
1758 | In this case you should use the shell escape from the editor (!) | |
1759 | to remove some files you don't need and try to write | |
1760 | the file again. | |
1761 | If this is not possible and you cannot find someone to help you, | |
1762 | enter the command | |
1763 | .DS I 1i | |
1764 | :\|\fBpreserve | |
1765 | .R | |
1766 | .DE | |
1767 | and then seek help. | |
1768 | Do not simply leave the editor. | |
1769 | If you do, the buffer will be lost, | |
1770 | and you may not be able to save your file. | |
1771 | After a preserve, you can use the recover command | |
1772 | once the problem has been corrected. | |
1773 | .PP | |
1774 | If you make an undesirable change to the buffer | |
1775 | and issue a write command before discovering your mistake, | |
1776 | the modified version will replace any previous version of the file. | |
1777 | Should you ever lose a good version of a document in this way, | |
1778 | do not panic and leave the editor. | |
1779 | As long as you stay in the editor, | |
1780 | the contents of the buffer remain accessible. | |
1781 | Depending on the nature of the problem, | |
1782 | it may be possible | |
1783 | to restore the buffer to a more complete | |
1784 | state with the undo command. | |
1785 | After fixing the damaged buffer, you can again write the file | |
1786 | to disk. | |
1787 | .SH | |
1788 | Further reading and other information | |
1789 | .PP | |
1790 | Edit is an editor designed for beginning and casual users. | |
1791 | It is actually a version of a more powerful editor called | |
1792 | .I ex. | |
1793 | These lessons are intended to introduce you to the editor | |
1794 | and its more commonly-used commands. | |
1795 | We have not covered all of the editor's commands, | |
1796 | just a selection of commands | |
1797 | which should be sufficient to accomplish most of your editing tasks. | |
1798 | You can find out more about the editor in the | |
1799 | .I | |
1800 | Ex Reference Manual, | |
1801 | .R | |
1802 | which is applicable to both | |
1803 | .I ex | |
1804 | and | |
1805 | .I edit. | |
1806 | The manual is available from the Computer Center Library, | |
1807 | 218 Evans Hall. | |
1808 | One way to become familiar with the manual is to begin by reading | |
1809 | the description of commands that you already know. | |
1810 | .bd I 3 | |
1811 | .SH | |
1812 | Using | |
1813 | .I ex | |
1814 | .fl | |
1815 | .bd I | |
1816 | .PP | |
1817 | As you become more experienced with using the editor, | |
1818 | you may still find that edit continues to meet your needs. | |
1819 | However, should you become interested in using ex, | |
1820 | it is easy to switch. | |
1821 | To begin an editing session with ex, | |
1822 | use the name | |
1823 | .B ex | |
1824 | in your command instead of | |
1825 | .B edit. | |
1826 | .PP | |
1827 | Edit commands work the same way in ex, | |
1828 | but the editing environment is somewhat different. | |
1829 | You should be aware of a few differences | |
1830 | that exist between the two versions of the editor. | |
1831 | In edit, only the characters ``^'', ``$'', and ``\\'' have | |
1832 | special meanings in searching the buffer | |
1833 | or indicating characters to be changed by a substitute command. | |
1834 | Several additional characters have ``magic'' | |
1835 | meanings in ex, as described in the | |
1836 | .I | |
1837 | Ex Reference Manual. | |
1838 | .R | |
1839 | Another feature of the edit environment prevents users from | |
1840 | accidently entering two alternative modes of editing, | |
1841 | .I open | |
1842 | and | |
1843 | .I visual, | |
1844 | in which | |
1845 | the editor behaves quite differently than in normal command mode. | |
1846 | If you are using ex and the editor behaves strangely, | |
1847 | you may have accidently entered open mode by typing ``o''. | |
1848 | Type the \s-2ESC\s0 key and then a ``q'' | |
1849 | to get out of open or visual mode and back into | |
1850 | the regular editor command mode. | |
1851 | The document | |
1852 | .I | |
1853 | An Introduction to Display Editing with Vi | |
1854 | .R | |
1855 | provides a full discussion of visual mode. | |
1856 | .sp 5 | |
1857 | .bd I 3 | |
1858 | .in +.7i | |
1859 | .ll -.7i | |
1860 | .nr LL -.7i | |
1861 | .LP | |
1862 | .I | |
1863 | This tutorial was produced at the Computer Center of the | |
1864 | University of California, Berkeley. | |
1865 | We welcome comments and suggestions concerning this item | |
1866 | and the \s-2UNIX\s0 documentation in general. | |
1867 | Contact the \s-2UNIX\s0 consultant in 217 Evans, 642-4072. | |
1868 | .fl | |
1869 | .bd I | |
1870 | .ND | |
1871 | .TL | |
1872 | Index | |
1873 | .sp 3 | |
1874 | .2C | |
1875 | .nf | |
1876 | addressing, \fIsee\fR line numbers | |
1877 | append mode, 4 | |
1878 | backslash (\\), 17 | |
1879 | buffer, 1 | |
1880 | command mode, 4 | |
1881 | context search, 7, 9, 13, 17 | |
1882 | control characters (``^'' notation), 7 | |
1883 | control-d, 5 | |
1884 | current filename, 18, 19 | |
1885 | current line (.), 8, 14 | |
1886 | diagnostic messages, 3 | |
1887 | disk, 1 | |
1888 | documentation, 20 | |
1889 | edit (to begin editing session), 2, 6 | |
1890 | editing commands: | |
1891 | .in +2 | |
1892 | append (a), 3, 4, 6 | |
1893 | change (c), 15 | |
1894 | copy (co), 12 | |
1895 | delete (d), 12-13 | |
1896 | edit (e), 11 | |
1897 | file (f), 18 | |
1898 | global (g), 16-17 | |
1899 | move (m), 11-12 | |
1900 | number (nu), 8 | |
1901 | preserve (pre), 19 | |
1902 | print (p), 7 | |
1903 | quit (q), 5, 10 | |
1904 | quit! (q!), 10 | |
1905 | read (r), 18-19 | |
1906 | recover (rec), 19 | |
1907 | substitute (s), 8-9, 16, 17 | |
1908 | undo (u), 13, 17 | |
1909 | write (w), 4-5, 10, 19 | |
1910 | z, 9 | |
1911 | .sp 10i | |
1912 | ! (shell escape), 18 | |
1913 | $= , 14 | |
1914 | +, 14 | |
1915 | \-, 14 | |
1916 | //, 7, 17 | |
1917 | ??, 17 | |
1918 | \&\fB.\fR, 8, 14 | |
1919 | \&\fB.\fR=, 8, 14 | |
1920 | .in -2 | |
1921 | erasing | |
1922 | .ti +2 | |
1923 | characters (#), 6 | |
1924 | .ti +2 | |
1925 | lines (@), 7 | |
1926 | ex (text editor), 20 | |
1927 | \fIEx Reference Manual\fR, 20 | |
1928 | file, 1 | |
1929 | file recovery, 19 | |
1930 | filename, 1 | |
1931 | Interrupt (message), 6 | |
1932 | line numbers, \fIsee also\fR current line | |
1933 | .ti +2 | |
1934 | dollar sign ($), 7, 14 | |
1935 | .ti +2 | |
1936 | dot (.), 8, 14 | |
1937 | .ti +2 | |
1938 | relative (+ and \-), 14 | |
1939 | logging out, 5 | |
1940 | login procedure, 2 | |
1941 | ``magic'' characters, 20 | |
1942 | non-printing characters, 7 | |
1943 | ``not found'' (message), 3 | |
1944 | program, 1 | |
1945 | recovery \fIsee\fR file recovery | |
1946 | shell, 18 | |
1947 | shell escape (!), 18 | |
1948 | special characters (^, $, \e), 17 | |
1949 | text input mode, 4 | |
1950 | UNIX, 1 |