(ed.info.gz) Line Addressing

Info Catalog (ed.info.gz) Invoking Ed (ed.info.gz) Top (ed.info.gz) Regular Expressions
 
 4 Line Addressing
 *****************
 
 An address represents the number of a line in the buffer. `ed'
 maintains a "current address" which is typically supplied to commands
 as the default address when none is specified. When a file is first
 read, the current address is set to the last line of the file. In
 general, the current address is set to the last line affected by a
 command.
 
    A line address is constructed from one of the bases in the list
 below, optionally followed by a numeric offset. The offset may include
 any combination of digits, operators (i.e., `+' and `-') and
 whitespace. Addresses are read from left to right, and their values may
 be absolute or relative to the current address.
 
    One exception to the rule that addresses represent line numbers is
 the address `0' (zero). This means "before the first line," and is
 valid wherever it makes sense.
 
    An address range is two addresses separated either by a comma or
 semicolon. The value of the first address in a range cannot exceed the
 value of the the second. If only one address is given in a range, then
 the second address is set to the given address. If an N-tuple of
 addresses is given where N > 2, then the corresponding range is
 determined by the last two addresses in the N-tuple. If only one
 address is expected, then the last address is used.
 
    Each address in a comma-delimited range is interpreted relative to
 the current address. In a semicolon-delimited range, the first address
 is used to set the current address, and the second address is
 interpreted relative to the first.
 
    The following address symbols are recognized.
 
 `.'
      The current line (address) in the buffer.
 
 `$'
      The last line in the buffer.
 
 `N'
      The Nth, line in the buffer where N is a number in the range `0,$'.
 
 `+'
      The next line. This is equivalent to `+1' and may be repeated with
      cumulative effect.
 
 `-'
      The previous line. This is equivalent to `-1' and may be repeated
      with cumulative effect.
 
 `+N'
 `WHITESPACE N'
      The Nth next line, where N is a non-negative number.  Whitespace
      followed by a number N is interpreted as `+N'.
 
 `-N'
      The Nth previous line, where N is a non-negative number.
 
 `,'
      The first through last lines in the buffer. This is equivalent to
      the address range `1,$'.
 
 `;'
      The current through last lines in the buffer. This is equivalent
      to the address range `.,$'.
 
 `/RE/'
      The next line containing the regular expression RE. The search
      wraps to the beginning of the buffer and continues down to the
      current line, if necessary. `//' repeats the last search.
 
 `?RE?'
      The previous line containing the regular expression RE. The search
      wraps to the end of the buffer and continues up to the current
      line, if necessary. `??' repeats the last search.
 
 `'x'
      The apostrophe-x character pair addresses the line previously
      marked by a `k' (mark) command, where `x' is a lower case letter
      from the portable character set.
 
 
Info Catalog (ed.info.gz) Invoking Ed (ed.info.gz) Top (ed.info.gz) Regular Expressions
automatically generated by info2html