Annotation of 43BSDReno/share/doc/usd/12.edtut/e1, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.