(ed.info.gz) Overview

Info Catalog (ed.info.gz) Top (ed.info.gz) Top (ed.info.gz) Introduction to Line Editing
 
 1 Overview
 **********
 
 `ed' is a line-oriented text editor. It is used to create, display,
 modify and otherwise manipulate text files. `red' is a restricted `ed':
 it can only edit files in the current directory and cannot execute
 shell commands.
 
    If invoked with a FILE argument, then a copy of FILE is read into
 the editor's buffer. Changes are made to this copy and not directly to
 FILE itself. Upon quitting `ed', any changes not explicitly saved with
 a `w' command are lost.
 
    Editing is done in two distinct modes: "command" and "input".  When
 first invoked, `ed' is in command mode. In this mode commands are read
 from the standard input and executed to manipulate the contents of the
 editor buffer. A typical command might look like:
 
      ,s/OLD/NEW/g
 
    which replaces all occurences of the string OLD with NEW.
 
    When an input command, such as `a' (append), `i' (insert) or `c'
 (change), is given, `ed' enters input mode. This is the primary means
 of adding text to a file. In this mode, no commands are available;
 instead, the standard input is written directly to the editor buffer. A
 "line" consists of the text up to and including a <newline> character.
 Input mode is terminated by entering a single period (`.') on a line.
 
    All `ed' commands operate on whole lines or ranges of lines; e.g.,
 the `d' command deletes lines; the `m' command moves lines, and so on.
 It is possible to modify only a portion of a line by means of
 replacement, as in the example above. However even here, the `s'
 command is applied to whole lines at a time.
 
    In general, `ed' commands consist of zero or more line addresses,
 followed by a single character command and possibly additional
 parameters; i.e., commands have the structure:
 
      [ADDRESS [,ADDRESS]]COMMAND[PARAMETERS]
 
    The ADDRESSes indicate the line or range of lines to be affected by
 the command. If fewer addresses are given than the command accepts,
 then default addresses are supplied.
 
Info Catalog (ed.info.gz) Top (ed.info.gz) Top (ed.info.gz) Introduction to Line Editing
automatically generated by info2html