home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / doc / ed.man < prev    next >
Text File  |  1990-01-09  |  32KB  |  648 lines

  1. NAME
  2.      ed, red - text editor
  3.  
  4. SYNTAX
  5.      ed [-] [-pstring] [file]
  6.  
  7.      red [-] [file]
  8.  
  9. DESCRIPTION
  10.      The ed text editor is the standard text editor.  If the file
  11.      argument is given, ed simulates an e command (see below) on
  12.      the named file; that is to say, the file is read into ed's
  13.      buffer so that it can be edited.  The optional - suppresses
  14.      the printing of character counts by e, r, and w commands, of
  15.      diagnostics from e and q commands, and of the ! prompt after
  16.      a !shell command.  The -p option allows the user to specify
  17.      a prompt string.  The ed text editor operates on a copy of
  18.      the file it is editing; changes made to the copy have no
  19.      effect on the file until a w (write) command is given.  The
  20.      copy of the text being edited resides in a temporary file
  21.      called the buffer.  There is only one buffer.
  22.  
  23.      The red text editor is a restricted version of ed. It only
  24.      allows editing of files in the current directory.  It prohi-
  25.      bits executing shell commands via !shell command.  Attempts
  26.      to bypass these restrictions result in an error message
  27.      (restricted shell).
  28.  
  29.                                  NOTE
  30.  
  31.           While inputting text, tab characters are expanded
  32.           to every eighth column as is the default.
  33.  
  34.  
  35.      Commands to ed have a simple and regular structure: zero,
  36.      one, or two addresses followed by a single-character com-
  37.      mand, possibly followed by parameters to that command.
  38.      These addresses specify one or more lines in the buffer.
  39.      Every command that requires addresses has default addresses,
  40.      so that the addresses can frequently be omitted.
  41.  
  42.      In general, only one command appears on a line.  Certain
  43.      commands allow the input of text.  This text is placed in
  44.      the appropriate place in the buffer.  While ed is accepting
  45.      text, it is said to be in input mode.  In input mode, no
  46.      commands are recognized; all input is merely collected.
  47.      Input mode is exited by typing a period (.) alone at the
  48.      beginning of a line.
  49.  
  50.      The ed text editor supports a limited form of regular
  51.      expression notation; regular expressions are used in
  52.      addresses to specify lines and in some commands (for exam-
  53.      ple, s) to specify portions of a line that are to be substi-
  54.      tuted.  A regular expression (RE) specifies a set of charac-
  55.      ter strings.  A member of this set of strings is said to be
  56.      matched by the RE.  The REs allowed by ed are constructed as
  57.      follows:
  58.  
  59.      The following one-character REs match a single character:
  60.  
  61.      1.1    An ordinary character (not one of those discussed in
  62.             1.2 below) is a one-character RE that matches itself.
  63.  
  64.      1.2    A backslash (\) followed by any special character is
  65.             a one-character RE that matches the special character
  66.             itself.  The special characters are:
  67.  
  68.             a.    ., *, [, and \ (period, asterisk, left square
  69.                   bracket, and backslash, respectively), which
  70.                   are always special, except when they appear
  71.                   within square brackets ([]; see 1.4 below).
  72.  
  73.             b.    ^ (caret or circumflex), which is special at
  74.                   the beginning of an entire RE (see 3.1 and 3.2
  75.                   below), or when it immediately follows the left
  76.                   of a pair of square brackets ([]) (see 1.4
  77.                   below).
  78.  
  79.             c.    $ (currency symbol), which is special at the
  80.                   end of an entire RE (see 3.2 below).
  81.  
  82.             d.    The character used to bound (that is, delimit)
  83.                   an entire RE, which is special for that RE (for
  84.                   example, see how slash (/) is used in the g
  85.                   command, below.)
  86.  
  87.      1.3    A period (.) is a one-character RE that matches any
  88.             character except new-line.
  89.  
  90.      1.4    A non-empty string of characters enclosed in square
  91.             brackets ([]) is a one-character RE that matches any
  92.             one character in that string.  If, however, the first
  93.             character of the string is a circumflex (^), the
  94.             one-character RE matches any character except new-
  95.             line and the remaining characters in the string.  The
  96.             ^ has this special meaning only if it occurs first in
  97.             the string.  The minus (-) may be used to indicate a
  98.             range of consecutive ASCII characters; for example,
  99.             [0-9] is equivalent to [0123456789].  The - loses
  100.             this special meaning if it occurs first (after an
  101.             initial ^, if any) or last in the string.  The right
  102.             square bracket (]) does not terminate such a string
  103.             when it is the first character within it (after an
  104.             initial ^, if any).  For example, []a-f] matches
  105.             either a right square bracket (]) or one of the
  106.             letters a through f inclusive.  The four characters
  107.             listed in 1.2.a above stand for themselves within
  108.             such a string of characters.
  109.  
  110.      The following rules may be used to construct REs from one-
  111.      character REs:
  112.  
  113.      2.1    A one-character RE is a RE that matches whatever the
  114.             one-character RE matches.
  115.  
  116.      2.2    A one-character RE followed by an asterisk (*) is a
  117.             RE that matches zero or more occurrences of the one-
  118.             character RE.  If there is any choice, the longest
  119.             leftmost string that permits a match is chosen.
  120.  
  121.      2.3    A one-character RE followed by \{m\}, \{m,\}, or
  122.             \{m,n\} is a RE that matches a range of occurrences
  123.             of the one-character RE.  The values of m and n must
  124.             be non-negative integers less than 256; \{m\} matches
  125.             exactly m occurrences; \{m,\} matches at least m
  126.             occurrences; \{m,n\} matches any number of
  127.             occurrences between m and n inclusive.  Whenever a
  128.             choice exists, the RE matches as many occurrences as
  129.             possible.
  130.  
  131.      2.4    The concatenation of REs is a RE that matches the
  132.             concatenation of the strings matched by each com-
  133.             ponent of the RE.
  134.  
  135.      2.5    A RE enclosed between the character sequences \( and
  136.             \) is a RE that matches whatever the unadorned RE
  137.             matches.
  138.  
  139.      2.6    The expression \n matches the same string of charac-
  140.             ters as was matched by an expression enclosed between
  141.             \( and \) earlier in the same RE.  Here n is a digit;
  142.             the sub-expression specified is that beginning with
  143.             the n-th occurrence of \( counting from the left.
  144.             For example, the expression ^\(.*\)\1$ matches a line
  145.             consisting of two repeated appearances of the same
  146.             string.
  147.  
  148.      Finally, an entire RE may be constrained to match only an
  149.      initial segment or final segment of a line (or both):
  150.  
  151.      3.1    A circumflex (^) at the beginning of an entire RE
  152.             constrains that RE to match an initial segment of a
  153.             line.
  154.  
  155.      3.2    A currency symbol ($) at the end of an entire RE con-
  156.             strains that RE to match a final segment of a line.
  157.  
  158.      The construction ^entire RE$ constrains the entire RE to
  159.      match the entire line.
  160.  
  161.      The null RE (for example, //) is equivalent to the last RE
  162.      encountered.  See also the last paragraph before FILES
  163.      below.
  164.  
  165.      To understand addressing in ed it is necessary to know that
  166.      at any time there is a current line.  Generally speaking,
  167.      the current line is the last line affected by a command; the
  168.      exact effect on the current line is discussed under the
  169.      description of each command.  Addresses are constructed as
  170.      follows:
  171.  
  172.       1.    The character . addresses the current line.
  173.  
  174.       2.    The character $ addresses the last line of the
  175.             buffer.
  176.  
  177.       3.    A decimal number n addresses the n-th line of the
  178.             buffer.
  179.  
  180.       4.    'x addresses the line marked with the mark name char-
  181.             acter x, which must be a lower-case letter.  Lines
  182.             are marked with the k command described below.
  183.  
  184.       5.    A RE enclosed by slashes (/) addresses the first line
  185.             found by searching forward from the line following
  186.             the current line toward the end of the buffer and
  187.             stopping at the first line containing a string match-
  188.             ing the RE.  If necessary, the search wraps around to
  189.             the beginning of the buffer and continues up to and
  190.             including the current line, so that the entire buffer
  191.             is searched.  See also the last paragraph before
  192.             FILES below.
  193.  
  194.       6.    A RE enclosed in question marks (?) addresses the
  195.             first line found by searching backward from the line
  196.             preceding the current line toward the beginning of
  197.             the buffer and stopping at the first line containing
  198.             a string matching the RE.  If necessary, the search
  199.             wraps around to the end of the buffer and continues
  200.             up to and including the current line.  See also the
  201.             last paragraph before FILES below.
  202.  
  203.       7.    An address followed by a plus sign (+) or a minus
  204.             sign (-) followed by a decimal number specifies that
  205.             address plus (respectively minus) the indicated
  206.             number of lines.  The plus sign may be omitted.
  207.  
  208.       8.    If an address begins with + or -, the addition or
  209.             subtraction is taken with respect to the current
  210.             line.  For example, -5 is understood to mean .-5.
  211.  
  212.       9.    If an address ends with + or -, then 1 is added to or
  213.             subtracted from the address, respectively.  As a
  214.             consequence of this rule and of rule 8 immediately
  215.             above, the address - refers to the line preceding the
  216.             current line.  (To maintain compatibility with ear-
  217.             lier versions of the editor, the character ^ in
  218.             addresses is entirely equivalent to -.) Moreover,
  219.             trailing + and - characters have a cumulative effect,
  220.             so -- refers to the current line less 2.
  221.  
  222.      10.    For convenience, a comma (,) stands for the address
  223.             pair 1,$, while a semicolon (;) stands for the pair
  224.             .,$.
  225.  
  226.      Commands may require zero, one, or two addresses.  Commands
  227.      that require no addresses regard the presence of an address
  228.      as an error.  Commands that accept one or two addresses
  229.      assume default addresses when an insufficient number of
  230.      addresses is given; if more addresses are given than such a
  231.      command requires, the last one(s) are used.
  232.  
  233.      Typically, addresses are separated from each other by a
  234.      comma (,).  They may also be separated by a semicolon (;).
  235.      In the latter case, the current line (.) is set to the first
  236.      address, and only then is the second address calculated.
  237.      This feature can be used to determine the starting line for
  238.      forward and backward searches (see rules 5. and 6. above).
  239.      The second address of any two-address sequence must
  240.      correspond to a line that follows, in the buffer, the line
  241.      corresponding to the first address.
  242.  
  243.      In the following list of ed commands, the default addresses
  244.      are shown in parentheses.  The parentheses are not part of
  245.      the address; they show that the given addresses are the
  246.      default.
  247.  
  248.      It is generally illegal for more than one command to appear
  249.      on a line.  However, any command (except e, f, r, or w) may
  250.      be suffixed by l, n or p, in which case the current line is
  251.      either listed, numbered or printed, respectively, as dis-
  252.      cussed below under the l, n and p commands.
  253.  
  254.      (.)a
  255.  
  256.      <text>
  257.  
  258.      .                   The append command reads the given text
  259.                          and appends it after the addressed line;
  260.                          . is left at the last inserted line, or,
  261.                          if there were none, at the addressed
  262.                          line.  Address 0 is legal for this com-
  263.                          mand: it causes the ``appended'' text to
  264.                          be placed at the beginning of the
  265.                          buffer.  The maximum number of charac-
  266.                          ters that may be entered from a terminal
  267.                          is 256 per line (including the new line
  268.                          character).
  269.  
  270.      (.)c
  271.      <text>
  272.      .
  273.                          The change command deletes the addressed
  274.                          lines, then accepts input text that
  275.                          replaces these lines; . is left at the
  276.                          last line input, or, if there were none,
  277.                          at the first line that was not deleted.
  278.  
  279.      (.,.)d
  280.                          The delete command deletes the addressed
  281.                          lines from the buffer.  The line after
  282.                          the last line deleted becomes the
  283.                          current line; if the lines deleted were
  284.                          originally at the end of the buffer, the
  285.                          new last line becomes the current line.
  286.  
  287.      e file
  288.                          The edit command causes the entire con-
  289.                          tents of the buffer to be deleted, and
  290.                          then the named file to be read in; . is
  291.                          set to the last line of the buffer.  If
  292.                          no file name is given, the currently-
  293.                          remembered file name, if any, is used
  294.                          (see the f command).  The number of
  295.                          characters read is typed; file is remem-
  296.                          bered for possible use as a default file
  297.                          name in subsequent e, r, and w commands.
  298.                          If file is replaced by !, the rest of
  299.                          the line is taken to be a shell, sh(1),
  300.                          command whose output is to be read.
  301.                          Such a shell command is not remembered
  302.                          as the current file name.  See also
  303.                          DIAGNOSTICS below.
  304.  
  305.      E file
  306.                          The edit command is like e, except that
  307.                          the editor does not check to see if any
  308.                          changes have been made to the buffer
  309.                          since the last w command.
  310.  
  311.      f file
  312.                          If file is given, the file-name command
  313.                          changes the currently-remembered file
  314.                          name to file; otherwise, it prints the
  315.                          currently-remembered file name.
  316.  
  317.      (1,$)g/RE/command list
  318.                          In the global command, the first step is
  319.                          to mark every line that matches the
  320.                          given RE.  Then, for every such line,
  321.                          the given command list is executed with
  322.                          . initially set to that line.  A single
  323.                          command or the first of a list of com-
  324.                          mands appears on the same line as the
  325.                          global command.  All lines of a multi-
  326.                          line list except the last line must be
  327.                          ended with a \; a, i, and c commands and
  328.                          associated input are permitted; the .
  329.                          terminating input mode may be omitted if
  330.                          it would be the last line of the command
  331.                          list.  An empty command list is
  332.                          equivalent to the p command.  The g, G,
  333.                          v, and V commands are not permitted in
  334.                          the command list.  See also RESTRICTIONS
  335.                          and the last paragraph before FILES
  336.                          below.
  337.  
  338.      (1,$)G/RE/
  339.                          In the interactive Global command, the
  340.                          first step is to mark every line that
  341.                          matches the given RE.  Then, for every
  342.                          such line, that line is printed, . is
  343.                          changed to that line, and any one com-
  344.                          mand (other than one of the a, c, i, g,
  345.                          G, v, and V commands) may be input and
  346.                          is executed.  After the execution of
  347.                          that command, the next marked line is
  348.                          printed, and so on; a new-line acts as a
  349.                          null command; an & causes the re-
  350.                          execution of the most recent command
  351.                          executed within the current invocation
  352.                          of G.  Note that the commands input as
  353.                          part of the execution of the G command
  354.                          may address and affect any lines in the
  355.                          buffer.  The G command can be terminated
  356.                          by an interrupt signal (ASCII DEL or
  357.                          BREAK).
  358.  
  359.      h
  360.                          The help command gives a short error
  361.                          message that explains the reason for the
  362.                          most recent ? diagnostic.
  363.  
  364.      H
  365.                          The help command causes ed to enter a
  366.                          mode in which error messages are printed
  367.                          for all subsequent ? diagnostics.  It
  368.                          will also explain the previous ? if
  369.                          there was one.  The H command alter-
  370.                          nately turns this mode on and off; it is
  371.                          initially off.
  372.  
  373.      (.)i
  374.      <text>
  375.      .
  376.                          The insert command inserts the given
  377.                          text before the addressed line; . is
  378.                          left at the last inserted line, or, if
  379.                          there were none, at the addressed line.
  380.                          This command differs from the a command
  381.                          only in the placement of the input text.
  382.                          Address 0 is not legal for this command.
  383.                          The maximum number of characters that
  384.                          may be entered from a terminal is 256
  385.                          per line (including the new line charac-
  386.                          ter).
  387.  
  388.  
  389.      (.,.+1)j
  390.                          The join command joins contiguous lines
  391.                          by removing the appropriate new-line
  392.                          characters.  If exactly one address is
  393.                          given, this command does nothing.
  394.  
  395.      (.)kx
  396.                          The mark command marks the addressed
  397.                          line with name x, which must be a
  398.                          lower-case letter.  The address 'x then
  399.                          addresses this line; . is unchanged.
  400.  
  401.      (.,.)l
  402.                          The list command prints the addressed
  403.                          lines in an unambiguous way: a few non-
  404.                          printing characters (for example, tab,
  405.                          backspace) are represented by (hope-
  406.                          fully) mnemonic overstrikes, all other
  407.                          non-printing characters are printed in
  408.                          octal, and long lines are folded.  An l
  409.                          command may be appended to any other
  410.                          command other than e, f, r, or w.
  411.  
  412.      (.,.)ma
  413.                          The B. move command repositions the
  414.                          addressed line(s) after the line
  415.                          addressed by a. Address 0 is legal for a
  416.                          and causes the addressed line(s) to be
  417.                          moved to the beginning of the file; it
  418.                          is an error if address a falls within
  419.                          the range of moved lines; . is left at
  420.                          the last line moved.
  421.  
  422.      (.,.)n
  423.                          The number command prints the addressed
  424.                          lines, preceding each line by its line
  425.                          number and a tab character; . is left at
  426.                          the last line printed.  The n command
  427.                          may be appended to any other command
  428.                          other than e, f, r, or w.
  429.  
  430.      (.,.)p
  431.                          The print command prints the addressed
  432.                          lines; . is left at the last line
  433.                          printed.  The p command may be appended
  434.                          to any other command other than e, f, r,
  435.                          or w; for example, dp deletes the
  436.                          current line and prints the new current
  437.                          line.
  438.  
  439.      P
  440.                          The editor will prompt with a * for all
  441.                          subsequent commands.  The P command
  442.                          alternately turns this mode on and off;
  443.                          it is initially off.
  444.  
  445.      q
  446.                          The quit command causes ed to exit.  No
  447.                          automatic write of a file is done (but
  448.                          see DIAGNOSTICS below).
  449.  
  450.      Q
  451.                          The editor exits without checking if
  452.                          changes have been made in the buffer
  453.                          since the last w command.
  454.  
  455.      ($)r file
  456.                          The read command reads in the given file
  457.                          after the addressed line.  If no file
  458.                          name is given, the currently-remembered
  459.                          file name, if any, is used (see e and f
  460.                          commands).  The currently-remembered
  461.                          file name is not changed unless file is
  462.                          the very first file name mentioned since
  463.                          ed was invoked.  Address 0 is legal for
  464.                          r and causes the file to be read at the
  465.                          beginning of the buffer.  If the read is
  466.                          successful, the number of characters
  467.                          read is typed; . is set to the last line
  468.                          read in.  If file is replaced by !, the
  469.                          rest of the line is taken to be a shell
  470.                          (sh(1)) command whose output is to be
  471.                          read.  For example, "$r !ls" appends
  472.                          current directory to the end of the file
  473.                          being edited.  Such a shell command is
  474.                          not remembered as the current file name.
  475.  
  476.      (.,.)s/RE/replacement/         or
  477.      (.,.)s/RE/replacement/g
  478.                          The substitute command searches each
  479.                          addressed line for an occurrence of the
  480.                          specified RE.  In each line in which a
  481.                          match is found, all (non-overlapped)
  482.                          matched strings are replaced by the
  483.                          replacement if the global replacement
  484.                          indicator g appears after the command.
  485.                          If the global indicator does not appear,
  486.                          only the first occurrence of the matched
  487.                          string is replaced.  It is an error for
  488.                          the substitution to fail on all
  489.                          addressed lines.  Any character other
  490.                          than space or new-line may be used
  491.                          instead of / to delimit the RE and the
  492.                          replacement; . is left at the last line
  493.                          on which a substitution occurred.  See
  494.                          also the last paragraph before FILES
  495.                          below.
  496.  
  497.                          An ampersand (&) appearing in the
  498.                          replacement is replaced by the string
  499.                          matching the RE on the current line.
  500.                          The special meaning of & in this context
  501.                          may be suppressed by preceding it by \.
  502.                          As a more general feature, the charac-
  503.                          ters \n, where n is a digit, are
  504.                          replaced by the text matched by the n-th
  505.                          regular subexpression of the specified
  506.                          RE enclosed between \( and \).  When
  507.                          nested parenthesized subexpressions are
  508.                          present, n is determined by counting
  509.                          occurrences of \( starting from the
  510.                          left.  When the character % is the only
  511.                          character in the replacement, the
  512.                          replacement used in the most recent sub-
  513.                          stitute command is used as the replace-
  514.                          ment in the current substitute command.
  515.                          The % loses its special meaning when it
  516.                          is in a replacement string of more than
  517.                          one character or is preceded by a \.
  518.  
  519.                          A line may be split by substituting a
  520.                          new-line character into it.  The new-
  521.                          line in the replacement must be escaped
  522.                          by preceding it by \.  Such substitution
  523.                          cannot be done as part of a g or v com-
  524.                          mand list.
  525.  
  526.      (.,.)ta
  527.                          This command acts just like the m com-
  528.                          mand, except that a copy of the
  529.                          addressed lines is placed after address
  530.                          a (which may be 0); . is left at the
  531.                          last line of the copy.
  532.  
  533.      u
  534.                          The undo command nullifies the effect of
  535.                          the most recent command that modified
  536.                          anything in the buffer, namely the most
  537.                          recent a, c, d, g, i, j, m, r, s, t, v,
  538.                          G, or V command.
  539.  
  540.      (1,$)v/RE/command list
  541.                          This command is the same as the global
  542.                          command g except that the command list
  543.                          is executed with . initially set to
  544.                          every line that does not match the RE.
  545.  
  546.      (1,$)V/RE/
  547.                          This command is the same as the interac-
  548.                          tive global command G except that the
  549.                          lines that are marked during the first
  550.                          step are those that do not match the RE.
  551.  
  552.      (1,$)w file
  553.                          The write command writes the addressed
  554.                          lines into the named file.  If the file
  555.                          does not exist, it is created with mode
  556.                          666 (readable and writable by everyone),
  557.                          unless your umask setting (see sh(1))
  558.                          dictates otherwise.  The currently-
  559.                          remembered file name is not changed
  560.                          unless file is the very first file name
  561.                          mentioned since ed was invoked.  If no
  562.                          file name is given, the currently-
  563.                          remembered file name, if any, is used
  564.                          (see e and f commands); . is unchanged.
  565.                          If the command is successful, the number
  566.                          of characters written is typed.  If file
  567.                          is replaced by !, the rest of the line
  568.                          is taken to be a shell (sh(1)) command
  569.                          whose standard input is the addressed
  570.                          lines.  Such a shell command is not
  571.                          remembered as the current file name.
  572.  
  573.      ($)=
  574.                          The line number of the addressed line is
  575.                          typed; . is unchanged by this command.
  576.  
  577.      !shell command
  578.                          The remainder of the line after the ! is
  579.                          sent to the UNIX System shell (sh(1)) to
  580.                          be interpreted as a command.  Within the
  581.                          text of that command, the unescaped
  582.                          character % is replaced with the remem-
  583.                          bered file name; if a ! appears as the
  584.                          first character of the shell command, it
  585.                          is replaced with the text of the previ-
  586.                          ous shell command.  Thus, !! will repeat
  587.                          the last shell command.  If any expan-
  588.                          sion is performed, the expanded line is
  589.                          echoed; . is unchanged.
  590.  
  591.      (.+1)<new-line>
  592.                          An address alone on a line causes the
  593.                          addressed line to be printed.  A new-
  594.                          line alone is equivalent to .+1p; it is
  595.                          useful for stepping forward through the
  596.                          buffer.
  597.  
  598.      If an interrupt signal (ASCII DEL or BREAK) is sent, ed
  599.      prints a ? and returns to its command level.
  600.  
  601.      Some size limitations: 512 characters per line, 256 charac-
  602.      ters per global command list, 64 characters per file name,
  603.      and 128K characters in the buffer.  The limit on the number
  604.      of lines depends on the amount of user memory: each line
  605.      takes 1 word.
  606.  
  607.      When reading a file, ed discards ASCII NUL characters and
  608.      all characters after the last new-line.  Files (for example,
  609.      a.out) that contain characters not in the ASCII set (bit 8
  610.      on) cannot be edited by ed.
  611.  
  612.      If the closing delimiter of a RE or of a replacement string
  613.      (for example, /) would be the last character before a new-
  614.      line, that delimiter may be omitted, in which case the
  615.      addressed line is printed.  The following pairs of commands
  616.      are equivalent:
  617.           s/s1/s2   s/s1/s2/p
  618.           g/s1      g/s1/p
  619.           ?s1       ?s1?
  620.  
  621. RESTRICTIONS
  622.      A ! command cannot be subject to a g or a v command.
  623.      The ! command and the ! escape from the e, r, and w commands
  624.      cannot be used if the the editor is invoked from a res-
  625.      tricted shell.  For further information, see sh(1).
  626.      The sequence \n in a RE does not match a new-line character.
  627.      The l command mishandles DEL.
  628.  
  629. DIAGNOSTICS
  630.      ?         for command errors.
  631.      ?file     for an inaccessible file.
  632.                (use the help and Help commands for detailed
  633.                explanations).
  634.  
  635.      If changes have been made in the buffer since the last w
  636.      command that wrote the entire buffer, ed warns the user if
  637.      an attempt is made to destroy ed's buffer via the e or q
  638.      commands: it prints ? and allows one to continue editing.  A
  639.      second e or q command at this point will take effect.  The -
  640.      command-line option inhibits this feature.
  641.  
  642. FILES
  643.      /tmp/e#   temporary; # is the process number.
  644.      ed.hup    work is saved here if the terminal is hung up.
  645.  
  646. SEE ALSO
  647.      grep(1), sed(1), sh(1), stty(1),
  648.