home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PASCAL / PT01.ZIP / TED.MAN < prev    next >
Encoding:
Text File  |  1983-09-07  |  3.8 KB  |  140 lines

  1. .im man.im
  2. .NM ted edit text files
  3. .SY ted [file]
  4. .FU
  5. .ital ted
  6. is an interactive text editor that reads command lines from its input
  7. and writes display information, upon command, to its output.
  8. It works by reading text files on command into an internal `buffer'
  9. (which may be quite large), displaying and modifying the buffer contents
  10. by other commands, then writing all or part of the buffer to text files,
  11. also on command.
  12. The buffer is organized as a sequence of lines, numbered from 1;
  13. lines are implicitly renumbered as text is added or deleted.
  14.  
  15. Context searches and substitutions are specified by writing text patterns,
  16. following the same rules for building patterns as used by
  17. .ital findp.
  18. Substitutions specify replacement text following the same rules as used
  19. by the program
  20. .ital change.
  21.  
  22. Line numbers are formed from the following components:
  23. .Q1
  24. n            a decimal number
  25. \.           the current line ("dot")
  26. $            the last line
  27. /pattern/    a forward context search
  28. \\pattern\\    a backward context search
  29. .Q2
  30. Components may be combined with
  31. .ital +
  32. or
  33. .ital -,
  34. as in, for example,
  35. .Q1
  36. \.+1         sum of . and 1
  37. $-5          five lines before $
  38. .Q2
  39. Line numbers are separated by commas or semicolons;
  40. a semicolon sets the current line to the most recent line number
  41. before proceeding.
  42.  
  43. Commands may be preceded by an arbitrary number of line numbers
  44. (except for
  45. .ital e,
  46. .ital f
  47. and
  48. .ital q,
  49. which require that none be present).
  50. The last one or two are used as needed.
  51. If two line numbers are needed and only one is specified,
  52. it is used for both.
  53. If no line numbers are specified, a default rule is applied:
  54. .Q1
  55. (.)     use the current line
  56. (.+1)   use the next line
  57. (.,.)   use the current line for both line numbers
  58. (1,$)   use all lines
  59. .Q2
  60. In alphabetical order, the commands and their default line numbers are:
  61. .Q1
  62. (.)   a             append text after line (text follows)
  63. (.,.) c             change text (text follows)
  64. (.,.) dp            delete text
  65.       e file        edit "file" after discarding all previous text,
  66.                     remember file name
  67.       f file        print file name, remember file name
  68. (.)   i             insert text before line (text follows)
  69. (.,.) m line3 p     move text to after "line3"
  70. (.,.) p             print text
  71.       q             quit
  72. (.)   r file        read "file", appending after line
  73. (.,.) s/pat/new/gp  substitute "new" for occurrence of "pat"
  74.                     (g implies for each occurrence across line)
  75. (1,$) w file        write "file" (leaves current state unaltered)
  76. (.)   =p            print line number
  77. (.+1) NEWLINE       print one line
  78. .Q2
  79. The trailing
  80. .ital p,
  81. which is optional, causes the last affected line to be printed.
  82. Dot is set to the last affected line, except for
  83. .ital f,
  84. .ital w,
  85. and
  86. .ital =,
  87. for which it is unchanged.
  88.  
  89. Text entered with
  90. .ital a,
  91. .ital c
  92. and
  93. .ital i
  94. is terminated with a line containing just a
  95. .ital `.'.
  96.  
  97. The global prefixes cause repeated execution of a command, once for
  98. each line that matches
  99. .ital (g)
  100. or does not match
  101. .ital (x)
  102. a specified text pattern:
  103. .Q1
  104. (1,$) g/pattern/command
  105. (1,$) x/pattern/command
  106. .Q2
  107. .sf 6
  108. command
  109. .sf 0
  110. can be anything but
  111. .ital a,
  112. .ital c,
  113. .ital i
  114. or
  115. .ital q,
  116. and may be preceded by line numbers as usual.
  117. Dot is set to the matched line before
  118. .sf 6
  119. command
  120. .sf 0
  121. is done.
  122.  
  123. If the command line argument
  124. .ital file
  125. is present,
  126. then the editor behaves as if its input began with the command
  127. .ital "e file".
  128. The first filename used is remembered, so that a subsequent
  129. .ital e,
  130. .ital f,
  131. .ital r,
  132. or
  133. .ital w
  134. command can be written with no filename to refer to the remembered filename.
  135. A filename given with
  136. .ital e
  137. or
  138. .ital f
  139. replaces any remembered filename.
  140.