Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ed(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

grep, egrep, fgrep

sed

sh, Rsh

stty, STTY

regcmp

environment



ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



-------------------------------------------------------------------------------
ed, red



PURPOSE

Starts a line editing program.

SYNTAX


one of
+-----+   +------+   +--------+
|  ed |---|      |---|        |---|
| red |   +- -p -+   +- file -+
+-----+


DESCRIPTION

The ed command is a line editing program that works on only one file at a time
by copying it into a temporary file buffer and making changes to that copy.
The ed command does not alter the file itself until you use the w (write)
subcommand.  You can specify on the command line the file you want to edit, or
you can use the e (edit) subcommands.

When the ed command reads a new file into the buffer, the contents of that file
replaces the buffer's previous contents, if any.

The red command is a restricted verstion of the ed command (see "sh, Rsh").
With the red command, you can edit only files that reside in the current
directory, or in the /tmp directory, and you cannot use the !AIX-cmd subcommand
(see page         13).

An ed subcommand consists of zero, one, or two addresses, which are followed by
a single-character subcommand, that may be followed by parameters.  These
addresses specify one or more lines in the buffer.  Because every subcommand
has default addresses, you frequently do not need to specify addresses.

The ed program operates in one of two modes, command mode or text mode.  In
command mode, ed recognizes and executes subcommands.  In text mode, ed adds
text to the file buffer but does not recognize subcommands.  To leave text
mode, enter a . (dot) alone at the beginning of a line.

PATTERN MATCHING

The ed command supports a limited form of special pattern-matching characters
that you can use as regular expressions (REs) to construct pattern strings.
You can use these patterns in addresses to specify lines and in some
subcommands to specify portions of a line.




Processed November 8, 1990       ED, RED(1,C)                                 1





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



Regular Expressions (REs)

The following REs match a single character:

char       Any valid character (other than one of the special pattern-matching
           characters) matches itself.

.          A period (matches any single character except for the new-line
           character.

[string]   A string enclosed in square brackets ([ ]) matches any one character
           in that string.  The string can contain Japanese characters.
           Certain pattern-matching characters have special meanings within
           square brackets:

           ^             If the first character of string is a circumflex, the
                         RE ([(^)string]) matches any character except the
                         characters in string and the new-line character.  A
                         (^) has this special meaning only if it occurs first
                         in the string.

           -             You can use a - (minus) to indicate a range of
                         consecutive ASCII characters according to the current
                         collating sequence.  For example, "[a-f]" might be
                         equivalent to "[abcdef]" or "[aAbBcCdDeEfF]" or
                         "[aaabcdeeef]".  The collating sequence is defined by
                         the environment variable LC_COLLATE or LANG.  See
                         Managing the AIX Operating System for more
                         information.  A collating sequence may define
                         equivalence classes for characters.  For example, if
                         three charactersc/-e, e, and e-are equivalent, the
                         following expressions identify the same sequence of
                         characters:

                           [a-e]
                           [a-e]

                         The minus character loses its special meaning if it
                         occurs first ([-string]), if it immediately follows an
                         initial circumflex ([(^)-string]), or if it appears
                         last ([string-]) in the string.

           ]             When the right square bracket (]) is the first
                         character in the string ([]string]) or when it
                         immediately follows an initial circumflex
                         ([^]string]), it is treated as a part of the string
                         rather than as the string terminator.

           [[:charclass:]]
                         Character class expressions allow you to match a
                         character type.  The system interprets this type of
                         expression according to the current class definition.



Processed November 8, 1990       ED, RED(1,C)                                 2





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



                         The class definition depends on the current system
                         language.  You cannot use character class expressions
                         in range expressions.

                         To use a character class expression, enclose it in
                         brackets and colons:

                           [[:charclass:]]

                         The following character classes are supported:

                         [:upper:]   Uppercase letters

                         [:lower:]   Lowercase letters

                         [:alpha:]   Uppercase and lowercase letters

                         [:digit:]   Digits

                         [:xdigit:]  Hexadecimal digits

                         [:punct:]   Punctuation character (neither a control
                                     character nor alphanumeric)

                         [:space:]   Space, tab, carriage return, new-line,
                                     vertical tab, or form-feed character

                         [:print:]   Printing character

                         For example, to match any uppercase letter or digit,
                         use the following expression:

                           [[:upper:] [:digit:]]

           "[[=c=]]"     Equivalence class; that is, any collation element
                         defined as having the same relative order in the
                         current collation sequence as c.  For example, if A
                         and a belong to the same equivalence class, both
                         "[[=A=]b]" and "[[=a=]b]" are equivalent to "[Aab]".

           "[[.cc.]]"    Collating symbol.  Multi-character collating elements
                         must be represented as collating symbols to
                         distinguish them from single-character elements.  For
                         example, if the string "ch" is a valid collating
                         element, "[[.ch.]]" is treated as an element matching
                         the same string of characters, while "ch" is treated
                         as a simple list of "c" and "h".  If the string is not
                         a valid collating element in the current collating
                         sequence definition, the symbol is treated as an
                         invalid expression.





Processed November 8, 1990       ED, RED(1,C)                                 3





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



\sym       A \ (backslash) followed by a special pattern-matching character
           matches the special character itself (as a literal character).
           These special pattern-matching characters are:

           . "*" [ \     Always special except when they appear within square
                         brackets ([]).

           ^             Special at the beginning of an entire pattern or when
                         it immediately follows the left bracket of a pair of
                         brackets ([(^)....]).

           "$"           Special at the end of an entire pattern.

           In addition, the character used to delimit an entire pattern is
           special for that pattern.  (For example, see how / (slash) is used
           in the g subcommand on page         9.)  This special pattern
           matching is described in more detail below.

Forming Patterns

The following rules describe how to form patterns from REs:

  1. An RE that consists of a single, ordinary character matches that same
    character in a string.

  2. An RE followed by an "*" (asterisk) matches zero or more occurrences of
    the character that the RE matches.  For example, the following pattern:

      ab*cd

    matches each of the following strings:

      acd
      abcd
      abbcd
      abbbcd

    but not the following string:

      abd

    If there is any choice, the longest matching leftmost string is chosen.
    For example, given the following string:

      122333444

    the pattern ".*" matches "122333444", the pattern ".*3" matches "122333",
    and the pattern ".*2" matches "122".

  3. An RE followed by:





Processed November 8, 1990       ED, RED(1,C)                                 4





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



    \{m\}   Matches exactly m occurrences of the character matched by the RE.

    \{m,\}  Matches at least m occurrences of the character matched by the RE.

    \{m,n\} Matches any number of occurrences of the character matched by the
            RE from m to n inclusive.

            m and n must be integers from 0 to 255, inclusive.  Whenever a
            choice exists, this pattern matches as many occurrences as
            possible.

  4. You can combine REs into patterns that match strings containing that same
    sequence of characters.  For example, "AB\*CD" matches the string "AB*CD",
    and "[[:alpha::]]*[[:digit:]]*" matches any string that contains any
    combination of alphabetic characters (including no occurrences), followed
    by any combination of numerals (including no occurrences).

  5. The character sequence "\("pattern"\)" marks a subpattern that matches the
    same string it would match if it were not enclosed.

  6. The characters \num match the same string of characters that a subpattern
    matched earlier in the pattern (see the preceding discussion of item 5).
    num is a digit.  The pattern \num matches the string matched by the numth
    subpattern, counting from left to right.  For example, the following
    pattern:

      \(A\)\(B\)C\2\1

    matches the string "ABCBA".  You can nest subpatterns.

Restricting Which Patterns Match

A pattern, which can contain Japanese characters, can be restricted to match
only the first segment of a line, the final segment, or both:

  1. A ^ (circumflex) at the beginning of a pattern causes the pattern to match
    only a string that begins in the first character position on a line.

  2. A "$" (dollar sign) at the end of a pattern causes that pattern to match
    only a string that ends with the last character (not including the new-line
    character) on a line.

  3. The construction ^pattern"$" restricts the pattern to matching only an
    entire line (The pattern must begin at the first character position and end
    at the last character position).

The null pattern (that is, //) duplicates the previous pattern.

ADDRESSING

There are three types of ed command addresses:  line number addresses,
addresses relative to the current line, and pattern addresses.  The current



Processed November 8, 1990       ED, RED(1,C)                                 5





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



line (usually the last line affected by a command) is the point of reference in
the buffer.  The current line is the default address for several ed commands.
(See "Parameters" to find out how each subcommand affects the current line.)

Following are guidelines for constructing addresses:

  1. . (dot) addresses the current line.

  2. "$" (dollar sign) addresses the last line of the buffer.

  3. n addresses the nth line of the buffer.

  4. 'x addresses the line marked with a lowercase ASCII letter, x, by the k
    subcommand (see page         10).

  5. /pattern/ (a pattern enclosed in slashes) addresses the next line that
    contains a matching string.  The search begins with the line after the
    current line and stops when it finds a match for the pattern.  If
    necessary, the search moves to the end of the buffer, wraps around to the
    beginning of the buffer, and continues until it either finds a match or
    returns to the current line.

  6. "?"pattern"?" (a pattern enclosed in question marks) addresses the
    previous line that contains a match for the pattern.  The "?"pattern"?"
    construct, like /pattern/, can search the entire buffer, but it does so in
    the opposite direction.

  7. An address followed by +n or -n (a plus sign or a minus sign followed by a
    decimal number) specifies an address plus or minus the indicated number of
    lines.  (The + sign is optional.)

  8. An address that begins with + or - specifies a line relative to the
    current line.  For example, "-5" is equivalent to ".-5" (five lines above
    the current line).

  9. An address that ends with - or + specifies the line immediately before (-)
    or immediately after (+) the addressed line.  Used alone, the - character
    addresses the line immediately before the current line.  The + character
    addresses the line immediately after the current line; however, the +
    character is optional.  The + and - characters have a cumulative effect;
    for example, the address -- addresses the line two lines above the current
    line.

 10. For convenience, a "," (comma) stands for the address pair "1,$" (first
    line through last line) and a ; (semicolon) stands for the pair ".,$"
    (current line through last line).

Commands that do not accept addresses regard the presence of an address as an
error.  Commands that do accept addresses can use either given or default
addresses.  When given more addresses than it accepts, a command uses the last
(rightmost) one(s).




Processed November 8, 1990       ED, RED(1,C)                                 6





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



In most cases, commas (",") separate addresses (for example "2,8").  Semicolons
(";") also can separate addresses.  A semicolon between addresses causes ed to
set the current line to the first address and then calculate the second address
(for example, to set the starting line for a search based on guidelines 5 and 6
above).  In a pair of addresses, the first must be numerically smaller than the
second.

For many purposes, you may prefer to use a different editor that has different
features:

  o "edit," a simple line editor for novice or casual users
  o "sed," a stream editor often used for writing programs
  o "ex," an extended (line) editor with interactive subcommand features
  o "vi, vedit, view," a visual (screen) editor that also accesses ex line
    editing features while letting you view the text.

A list of ed size limitations follows.  If you have selected a language
(through the LANG environment variable) that supports multibyte characters, the
following character limits can be reduced by as much as 50%, depending on the
character code set being used.

  o 64 characters per file name.
  o 512 characters per line (although there is currently a system-imposed limit
    of 255 characters per line entered from the keyboard).
  o 256 characters per global subcommand list.

The maximum number of lines depends on the amount of memory available to you.
The maximum file size depends on the amount of physical data storage (disk or
tape drive) available or on the maximum number of lines permitted in user
memory.

PARAMETERS

In most cases, only one ed subcommand can be entered on a line.  The exceptions
to this rule are the p and l subcommands, which can be added to any subcommand
except e, f, r, or w.  The e, f, r, and w subcommands accept file names as
parameters.  The ed program stores the last file name used with a subcommand as
a default file name.  The next e, f, r, or w subcommand given without a file
name uses the default file name.

The ed program responds to an error condition with one of two messages:  "?"
(question mark) or "?"file.  When ed receives an INTERRUPT signal (Ctrl-C), it
displays a "?" and returns to command mode.  When the ed program reads a file,
it discards ASCII NULL characters and all characters after the last new-line
character.

In the following list of ed subcommands, default addresses are shown in
parentheses.  Do not enter the parentheses.  The address . (period) refers to
the current line.  When a . is shown in the first position on an otherwise
empty line, it is the signal to return to command mode.

(.)a



Processed November 8, 1990       ED, RED(1,C)                                 7





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



text
.                 The a (append) subcommand adds text to the buffer after the
                  addressed line.  The a subcommand sets the current line to
                  the last inserted line, or, if no lines are inserted, to the
                  addressed line.  Address "0" causes the a subcommand to add
                  text at the beginning of the buffer.

(.)c
text
.                 The c (change) subcommand deletes the addressed lines, then
                  replaces them with new input.  The c command sets the current
                  line to the last new line of input, or, if there are no
                  lines, to the first line that is not deleted.

(.,.)d            The d (delete) subcommand removes the addressed lines from
                  the buffer.  The line after the last line deleted becomes the
                  current line.  If the deleted lines were originally at the
                  end of the buffer, the new last line becomes the current
                  line.

e file            The e (edit) subcommand first deletes any contents from the
                  buffer.  The command then loads another file into the buffer,
                  sets the current line to the last line of the buffer, and
                  displays the number of characters read in to the buffer.  If
                  the buffer has been changed since its contents were last
                  saved (with the w subcommand), the e command displays "?"
                  before it clears the buffer.

                  The e subcommand stores file as the default file name to be
                  used, if necessary, by subsequent e, r, or w subcommands.
                  (See the f subcommand.)

                  When the "!" character replaces file, the e subcommand takes
                  the rest of the line as an AIX shell (sh) command and reads
                  the command output.  The e subcommand does not store the name
                  of the shell command as a default file name.

E file            The E (edit) subcommand works like the e subcommand, with one
                  exception:  E does not check for changes made to the buffer
                  since the last w subcommand.

f [file]          The f (filename) subcommand changes the default file name
                  (the stored name of the last file used) to file, if file is
                  given.  If file is not given, the f subcommand prints the
                  default file name.

(1,"$")g/pattern/subcmd-list
                  The g (global) subcommand first marks every line that matches
                  the pattern Then, for each marked line, this subcommand sets
                  the current line to that line and executes subcmd-list.  A
                  single subcommand, or the first subcommand of a list, should
                  appear on the same line with the g subcommand; subsequent



Processed November 8, 1990       ED, RED(1,C)                                 8





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



                  subcommands should appear on separate lines.  Except for the
                  last line, each line containing a subcommand should end with
                  a \.

                  The subcmd-list can include the a, i, and c subcommands and
                  their input.  If the last command in subcmd-list would
                  normally be the . (dot) that ends input mode, the . (dot) is
                  optional.  If there is no subcmd-list, the ed command
                  displays the current line.  The subcmd-list can include any
                  subcommands except the g, G, v, or V subcommands.

                  Note:  The g subcommand is similar to the v subcommand, which
                         executes subcmd-list for every line that does not
                         contain a match for the pattern.

(1,"$")G/pattern/ The interactive G (Global) subcommand first marks every line
                  that matches the pattern.  The command displays the first
                  marked line, sets the current line to that line, and waits
                  for a subcommand.  The G subcommand accepts any but the
                  following ed subcommands:  a, c, i, g, G, v, and V.  After
                  the subcommand finishes, G displays the next marked line, and
                  so on.  The G command takes a new-line character as a null
                  subcommand.  An & causes G to execute the previous subcommand
                  again, if there was one.  Subcommands executed within the G
                  subcommand can address and change any lines in the buffer.
                  The G subcommand can be terminated by pressing the INTERRUPT
                  key (Ctrl-C).

                  Note:  The G subcommand complements the V subcommand, which
                         marks lines that do not match the pattern.

h                 The h (help) subcommand gives a short explanation (help
                  message) for the most recent ? diagnostic or error message.

H                 The H (Help) subcommand causes ed to display the help
                  messages for all subsequent "?" diagnostics.  H also explains
                  the previous "?" if there was one.  H alternately turns this
                  mode on and off; it is initially off.

(.)i
<text>
.                 The i (Insert) subcommand inserts text before the addressed
                  line and sets the current line to the last inserted line.  If
                  no lines are inserted, i sets the current line to the
                  addressed line.  This subcommand differs from the a
                  subcommand only in the placement of the input text.  Address
                  0 is not legal for this subcommand.

(.,.+1)j          The j (join) subcommand joins contiguous lines by removing
                  the intervening new-line characters.  If given only one
                  address, j does nothing.  (For splitting lines, see the s
                  subcommand.)



Processed November 8, 1990       ED, RED(1,C)                                 9





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)




(.)kx             The k (mark) subcommand marks the addressed line with name x,
                  which must be a lowercase ASCII letter.  The address 'x
                  (single quotation mark before the marking character) then
                  addresses this line.  The k subcommand does not change the
                  current line.

(.,.)l            The l (list) subcommand displays the addressed lines.  The l
                  subcommand wraps long lines and, unlike the p subcommand,
                  represents non-printing characters, either with mnemonic
                  overstrikes or in octal notation.  An l subcommand may be
                  appended to any ed subcommand except e, f, r, or w.

(.,.)ma           The m (move) subcommand repositions the addressed lines.  The
                  first moved line follows the line addressed by a.  Address
                  "0" for a causes m to move the addressed lines to the
                  beginning of the file.  Address a cannot be one of the lines
                  to be moved.  The m subcommand sets the current line to the
                  last moved line.

(.,.)n            The n (number) subcommand displays the addressed lines, each
                  preceded by its line number and a tab character (displayed as
                  blank spaces); n leaves the current line at the last line
                  displayed.  An n subcommand may be appended to any ed
                  subcommand except e, f, r, or w.

(.,.)p            The p (print) subcommand displays the addressed lines and
                  sets the current line set to the last line displayed.  A p
                  subcommand may be appended to any ed subcommand except:  e,
                  f, r, or w.  For example, the subcommand dp deletes the
                  current line and displays the new current line.

P                 The P subcommand turns on or off the ed prompt string "*"
                  (asterisk).  Initially, the ed prompt string is turned off.

q                 The q (quit) subcommand ends the ed program.  Before ending
                  the program, q checks to determine whether the buffer has
                  been written to a file since the last time it was changed.
                  If not, q displays the ? message.

Q                 The Q (Quit) subcommand ends the ed program without checking
                  for changes to the buffer since the last w subcommand was
                  entered (compare with the q subcommand).

(".")r file       The r (read) subcommand reads a file into the buffer after
                  the addressed line but does not delete the previous contents
                  of the buffer.  If you do not specify file, the command reads
                  the default file, if any, into the buffer (see the e and f
                  subcommands).  The r command does not change the default file
                  name.  Address "0" causes r to read a file in at the
                  beginning of the buffer.  If no address is given, the file is
                  read in after the current line.  After it reads a file



Processed November 8, 1990       ED, RED(1,C)                                10





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



                  successfully, the r command displays the number of characters
                  read into the buffer and sets the current line to the last
                  line read.

                  If "!" (exclamation point) replaces file the r subcommand
                  takes the rest of the line as an AIX shell (sh) command whose
                  output is to be read.  The r subcommand does not store the
                  names of shell commands as default file names.

(.,.)s/pattern/replacement/

(.,.)s/pattern/replacement/g
                  The s (substitute) subcommand searches each addressed line
                  for a string that matches the pattern and then replaces the
                  string with the specified replacement string.  Without the
                  global indicator g, the s command replaces only the first
                  matching string on each addressed line.  With the g
                  indicator, the s command replaces every occurrence of the
                  matching string on each addressed line.  If s does not find a
                  match for the pattern, it returns the error message "?".  Any
                  character except a space or a new-line character can separate
                  (delimit) the pattern and replacement.  The s subcommand sets
                  the current line to the last line changed.

                  An ("&") ampersand in the replacement string is a special
                  symbol that has the same value as the pattern string.  So,
                  for example, the subcommand s/are/&n't/ has the same effect
                  as the subcommand s/are/aren't/ and replaces are with aren't
                  on the current line.  A backslash before the ampersand (\"&")
                  removes this special meaning of "&" in replacement.

                  A subpattern is part of a pattern enclosed by the delimiting
                  characters \( and \); the pattern works as if the enclosing
                  characters were not present.  In replacement, the characters
                  \n refer to strings that match subpatterns; n, a decimal
                  number, refers to the nth subpattern, counting from the left.
                  (For example, s/\(t\)\(h\) \(e\)/t\1\2ose) replaces the with
                  those if there is a match for the pattern the on the current
                  line.)  Whether subpatterns are nested or in a series, \n
                  refers to the nth occurrence, counting from the left, of the
                  delimiting characters, \).

                  The "%" (percent sign) character, when used by itself as
                  replacement, causes the s command to use the previous
                  replacement again.  The "%" character does not have this
                  special meaning if it is part of a longer replacement or if
                  it is preceded by a \.

                  Lines may be split by substituting new-line characters into
                  them.  In replacement, the sequence \Enter quotes the
                  new-line character (not displayed) and moves the cursor to




Processed November 8, 1990       ED, RED(1,C)                                11





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



                  the next line for the remainder of the string.  New lines
                  cannot be substituted as part of a g or v subcommand list.

(.,.)ta           The t(transfer) subcommand inserts a copy of the addressed
                  lines after address a.  The t subcommand accepts address "0"
                  (for inserting lines at the beginning of the buffer).  The t
                  subcommand sets the current line to the last line copied.

u                 The u (undo) subcommand restores the buffer to the state it
                  was in before it was last modified by an ed subcommand.  The
                  commands that the u command can undo are a, c, d, g, G, i, j,
                  m, r, s, t, u, v, and V.

(1,"$")v/pattern/subcmd-list
                  The v subcommand executes the subcommands in subcmd-list for
                  each line that does not contain a match for the pattern.  If
                  you enter & as the subcmd-list, this executes the last
                  substitution command entered.

                  Note:  The v subcommand is a complement for the global
                         subcommand g, which executes subcmd-list for every
                         line that does contain a match for the pattern.

(1,$)V/pattern//  The V subcommand first marks every line that does not match
                  the pattern.  The command then displays the first marked
                  line, the current line to that line, and waits for a
                  subcommand.

                  Note:  The V subcommand complements the G subcommand, which
                         marks the lines that do match the pattern.

(1,"$")w file     The w (write) subcommand copies the addressed lines from the
                  buffer to the file named in file.  If no addressed lines are
                  given, this subcommand copies the entire buffer.  If the file
                  does not exist, the w subcommand creates it with permission
                  code 666 (read and write permission for everyone), unless the
                  umask setting specifies another file creation mode.  (For
                  information about file permissions, see "umask" and "chmod.")
                  The w subcommand does not change the default file name
                  (unless file is the first file name used since you started
                  ed).  If you do not provide a file name, ed uses the default
                  file name, if any (see the e and f subcommands).  The w
                  subcommand does not change the current line.

                  If the ed command successfully writes the file, it displays
                  the number of characters written.  When "!" (exclamation
                  point) replaces file, the ed program takes the rest of the
                  line as an AIX shell (sh) command whose output is to be read;
                  the w subcommand does not save shell command names as default
                  file names.





Processed November 8, 1990       ED, RED(1,C)                                12





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



                  Note:  Address "0" is not legal address for the w subcommand.
                         Therefore, it is not possible to create an empty file
                         with the ed command.

("$")=            With a numeric address, = displays the associated line
                  number.  Without an address, the = (equal sign) subcommand
                  displays the current line number.  With the address "$", the
                  = subcommand displays the number of the last line in the
                  buffer.  The = subcommand does not change the current line
                  and cannot be included in a g or v subcommand list.

!AIX-cmd          The "!" (exclamation point) subcommand allows AIX commands to
                  be run from within the ed command.  Anything following ! on
                  an ed subcommand line is interpreted as an AIX command.
                  Within the text of that command string, ed replaces the
                  unescaped character "%" with the current file name, if there
                  is one.

                  When used as the first character of a shell command (after
                  the "!" that runs a subshell) the ed command replaces the "!"
                  character with the previous AIX command; for example, the
                  command !! repeats the previous AIX command.  If the AIX
                  command interpreter (the sh command), expands the command
                  string, ed echoes the expanded line.  The "!" subcommand does
                  not change the current line.

num
+num
-num              The ed command interprets a number alone on a line as an
                  address and displays the addressed line.  Addresses can be
                  absolute (line numbers or "$") or relative to the current
                  line ("+"num or - num).  Entering a new-line character (a
                  blank line) is equivalent to entering +1p and is useful for
                  stepping forward through the buffer one line at a time.

FLAGS

-                 Suppresses character counts that the editor displays with the
                  e, r, and w subcommands; suppresses diagnostic messages for
                  the e and q subcommands; and suppresses the "!" prompt after
                  a !AIX-cmd subcommand.

-p string         Sets the editor prompt to string.  The default for string is
                  null (no prompt).

FILES

/tmp/e#     Temporary file; # is the process number.
ed.hup      Work is saved in this file the terminal hangs up while the the ed
            command is running.





Processed November 8, 1990       ED, RED(1,C)                                13





ED, RED(1,C)                AIX Commands Reference                 ED, RED(1,C)



RELATED INFORMATION

See the following commands:  "grep, egrep, fgrep,"  "sed,"  "sh, Rsh," "stty,
STTY," and  "regcmp."

See the regexp subroutine in AIX Operating System Technical Reference.

See the environment miscellaneous facility in AIX Operating SystemTechnical
Reference.

See "Introduction to International Character Support" in Managing the AIX
Operating System.

See "Programming for an MBCS Environment" in AIX Operating System Programming
Tools and Interfaces.








































Processed November 8, 1990       ED, RED(1,C)                                14



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026