edscript.icn: Program to produce script for ed(1)

March 7, 1998; Ralph E. Griswold
This file is in the public domain.
   This program takes specifications for global edits from standard
input and outputs an edit script for the UNIX editor ed to standard output.
Edscript is primarily useful for making complicated literal sub-
stitutions that involve characters that have syntactic meaning to
ed and hence are difficult to enter in ed.

   Each specification begins with a delimiter, followed by a tar-
get string, followed by the delimiter, followed by the replace-
ment string, followed by the delimiter.  For example

        |...|**|
        |****||

specifies the replacement of all occurrences of three consecutive
periods by two asterisks, followed by the deletion of all
occurrences of four consecutive asterisks.  Any character may be
used for the delimiter, but the same character must be used in
all three positions in any specification, and the delimiter char-
acter cannot be used in the target or replacement strings.

Diagnostic:

   Any line that does not have proper delimiter structure is noted
and does not contribute to the edit script.

Reference:

   "A Tutorial Introduction to the UNIX Text Editor", Brian W. Kernighan.
AT&T Bell Laboratories.

Source code | Program Library Page | Icon Home Page