Blame README

Packit Bot a3ac83
Description
Packit Bot a3ac83
Packit Bot a3ac83
GNU ed is a line-oriented text editor. It is used to create, display,
Packit Bot a3ac83
modify and otherwise manipulate text files, both interactively and via
Packit Bot a3ac83
shell scripts. A restricted version of ed, red, can only edit files in
Packit Bot a3ac83
the current directory and cannot execute shell commands. Ed is the
Packit Bot a3ac83
"standard" text editor in the sense that it is the original editor for
Packit Bot a3ac83
Unix, and thus widely available. For most purposes, however, it is
Packit Bot a3ac83
superseded by full-screen editors such as GNU Emacs or GNU Moe.
Packit Bot a3ac83
Packit Bot a3ac83
Extensions to and deviations from the POSIX standard are described below.
Packit Bot a3ac83
Packit Bot a3ac83
See the file INSTALL for compilation and installation instructions.
Packit Bot a3ac83
Packit Bot a3ac83
Try "ed --help" for usage instructions.
Packit Bot a3ac83
Packit Bot a3ac83
Report bugs to bug-ed@gnu.org
Packit Bot a3ac83
Packit Bot a3ac83
Ed home page: http://www.gnu.org/software/ed/ed.html
Packit Bot a3ac83
Packit Bot a3ac83
For a description of the ed algorithm, see Kernighan and Plauger's book
Packit Bot a3ac83
"Software Tools in Pascal", Addison-Wesley, 1981.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
GNU ed(1) is not strictly POSIX compliant, as described in the
Packit Bot a3ac83
POSIX 1003.1-2004 document.  The following is a summary of omissions
Packit Bot a3ac83
and extensions to, and deviations from, the POSIX standard.
Packit Bot a3ac83
Packit Bot a3ac83
OMISSIONS
Packit Bot a3ac83
---------
Packit Bot a3ac83
  * Locale(3) is not supported.
Packit Bot a3ac83
Packit Bot a3ac83
EXTENSIONS
Packit Bot a3ac83
----------
Packit Bot a3ac83
  * Though GNU ed is not a stream editor, it can be used to edit binary files.
Packit Bot a3ac83
    To assist in binary editing, when a file containing at least one ASCII
Packit Bot a3ac83
    NUL character is written, a newline is not appended if it did not
Packit Bot a3ac83
    already contain one upon reading.  In particular, reading /dev/null
Packit Bot a3ac83
    prior to writing prevents appending a newline to a binary file.
Packit Bot a3ac83
Packit Bot a3ac83
    For example, to create a file with GNU ed containing a single NUL character:
Packit Bot a3ac83
      $ ed file
Packit Bot a3ac83
      a
Packit Bot a3ac83
      ^@
Packit Bot a3ac83
      .
Packit Bot a3ac83
      r /dev/null
Packit Bot a3ac83
      wq
Packit Bot a3ac83
Packit Bot a3ac83
    Similarly, to remove a newline from the end of binary 'file':
Packit Bot a3ac83
      $ ed file
Packit Bot a3ac83
      r /dev/null
Packit Bot a3ac83
      wq
Packit Bot a3ac83
Packit Bot a3ac83
  * BSD commands have been implemented wherever they do not conflict with
Packit Bot a3ac83
    the POSIX standard.  The BSD-ism's included are:
Packit Bot a3ac83
      * 's' (i.e., s[1-9rgp]*) to repeat a previous substitution,
Packit Bot a3ac83
      * 'W' for appending text to an existing file,
Packit Bot a3ac83
      * 'wq' for exiting after a write, and
Packit Bot a3ac83
      * 'z' for scrolling through the buffer.
Packit Bot a3ac83
Packit Bot a3ac83
  * The POSIX interactive global commands 'G' and 'V' are extended to
Packit Bot a3ac83
    support multiple commands, including 'a', 'i' and 'c'.  The command
Packit Bot a3ac83
    format is the same as for the global commands 'g' and 'v', i.e., one
Packit Bot a3ac83
    command per line with each line, except for the last, ending in a
Packit Bot a3ac83
    backslash (\).
Packit Bot a3ac83
Packit Bot a3ac83
  * The file commands 'E', 'e', 'r', 'W' and 'w'  process a <file>
Packit Bot a3ac83
    argument for backslash escapes; i.e., any character preceded by a
Packit Bot a3ac83
    backslash is interpreted literally. If the first character of a
Packit Bot a3ac83
    <file> argument is a bang (!), then the rest of the line is
Packit Bot a3ac83
    interpreted as a shell command, and no escape processing is
Packit Bot a3ac83
    performed by GNU ed.
Packit Bot a3ac83
Packit Bot a3ac83
  * For SunOS ed(1) compatibility, GNU ed runs in restricted mode if invoked
Packit Bot a3ac83
    as red.  This limits editing of files in the local directory only and
Packit Bot a3ac83
    prohibits shell commands.
Packit Bot a3ac83
Packit Bot a3ac83
DEVIATIONS
Packit Bot a3ac83
----------
Packit Bot a3ac83
  * To support the BSD 's' command (see EXTENSIONS above), substitution
Packit Bot a3ac83
    patterns cannot be delimited by the digits '1' to '9' or by the
Packit Bot a3ac83
    characters 'r', 'g' and 'p'. In contrast, POSIX specifies that any
Packit Bot a3ac83
    character except space and newline can be used as a delimiter.
Packit Bot a3ac83
Packit Bot a3ac83
  * Since the behavior of 'u' (undo) within a 'g' (global) command list is
Packit Bot a3ac83
    not specified by POSIX, GNU ed follows the behavior of the SunOS ed:
Packit Bot a3ac83
    undo forces a global command list to be executed only once, rather than
Packit Bot a3ac83
    for each line matching a global pattern.  In addtion, each instance of
Packit Bot a3ac83
    'u' within a global command undoes all previous commands (including
Packit Bot a3ac83
    undo's) in the command list.  This seems the best way, since the
Packit Bot a3ac83
    alternatives are either too complicated to implement or too confusing
Packit Bot a3ac83
    to use.
Packit Bot a3ac83
Packit Bot a3ac83
  * The 'm' (move) command within a 'g' command list also follows the SunOS
Packit Bot a3ac83
    ed implementation: any moved lines are removed from the global command's
Packit Bot a3ac83
    'active' list.
Packit Bot a3ac83
Packit Bot a3ac83
  * For backwards compatibility, errors in piped scripts do not force ed
Packit Bot a3ac83
    to exit.  POSIX only specifies ed's response for input via regular
Packit Bot a3ac83
    files (including here documents) or tty's.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
TESTSUITE
Packit Bot a3ac83
---------
Packit Bot a3ac83
The files in the 'testsuite' directory with extensions '.ed', '.r', and
Packit Bot a3ac83
'.err' are used for testing ed. To run the tests, configure the package
Packit Bot a3ac83
and type 'make check' from the build directory. The tests do not
Packit Bot a3ac83
exhaustively verify POSIX compliance nor do they verify correct 8-bit or
Packit Bot a3ac83
long line support.
Packit Bot a3ac83
Packit Bot a3ac83
The test file extensions have the following meanings:
Packit Bot a3ac83
.ed   Ed script - a list of ed commands.
Packit Bot a3ac83
.r    Result - the expected output after processing data via an ed
Packit Bot a3ac83
      script.
Packit Bot a3ac83
.err  Error - invalid ed commands that should generate an error.
Packit Bot a3ac83
Packit Bot a3ac83
The output of the .ed scripts is written to files with .o extension and
Packit Bot a3ac83
compared with their corresponding .r result files. The .err scripts
Packit Bot a3ac83
should exit with non-zero status without altering the contents of the
Packit Bot a3ac83
buffer.
Packit Bot a3ac83
Packit Bot a3ac83
If any test fails, the error messages look like:
Packit Bot a3ac83
Packit Bot a3ac83
	*** The script u.ed exited abnormally ***
Packit Bot a3ac83
or:
Packit Bot a3ac83
	*** Output u.o of script u.ed is incorrect ***
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
Copyright (C) 1993, 1994 Andrew Moore
Packit Bot a3ac83
Copyright (C) 2006-2017 Antonio Diaz Diaz.
Packit Bot a3ac83
Packit Bot a3ac83
This file is free documentation: you have unlimited permission to copy,
Packit Bot a3ac83
distribute and modify it.
Packit Bot a3ac83
Packit Bot a3ac83
The file Makefile.in is a data file used by configure to produce the
Packit Bot a3ac83
Makefile. It has the same copyright owner and permissions that configure
Packit Bot a3ac83
itself.