1.1;ed (edit), revision 1.1, 87/03/20
ED (EDIT) -- Invoke line editor.
usage: ED [-N] [pathname]
")
FORMAT
ED [-N] [pathname]
ED invokes the line editor. Input text and editing commands are read from
standard input. While you may use ED to create text files interactively, it
is better suited for use in programs and scripts. Use the <EDIT> key or the
DM command, CE, to create and edit files interactively.
NOTE: There is a homonymous DM command: ED -- Delete character preceding
cursor. Type HELP ED_DM for details.
ARGUMENTS
pathname
(optional) Specify file to be edited. ED reads the file into a buffer
for editing and remembers its name for future use. ED
operates on the buffer copy; changes made there have no
effect on the original file until you issue a W (write)
command from within ED. Files must be less than 6400 lines
and less than 256,000 characters.
If the 'pathname' argument is omitted, the edit buffer is
empty and no file name is remembered for future use. You
will have to specify an explicit file name when you exit
the editor.
Default if omitted: see above
OPTIONS
-N Suppress the printing of line counts by the E (edit), R
(read), and W (write) commands.
SUMMARY OF ED COMMANDS
Addresses:
17 a decimal number
. the current line
$ the last line of the file
/pat/ search forward for line containing pat
\pat\ search backward for line containing pat
line+n n lines forward from line
line-n n lines backward from line
Defaults:
(.) use current line
(.+1) use the next line
(.,.) use current line for both line numbers
(1,$) use all lines
Commands:
(.) A Append text after line (text follows)
(.,.n) Bn Browse over the next n lines (default n is 22).
If n is negative, print last n lines before
current line. If 'B.' is specified, print n
lines with current line in center of screen.
(.,.) C Change text (text follows)
(.,.) D Delete text
E file Discard current text, enter file, remember
filename
F Print filename
F file Remember filename
(.) I Insert text before line (text follows)
(.,.) Kline Copy text to new line after specified line
(.,.) Mline Move text to line after specified line
(.,.) P Print text (can be appended to other commands)
Q Quit
(.) R [file] Read file, appending after current line
(.,.) S/pat/new/GP Substitute new for leftmost pat (G implies all
occurrences)
(1,$) W [file] Write file, leave current text unaltered (if
no file is specified, write to current filename)
(.) =[P] Print line number, current line
(.+1) <CR> Print next line
(1,$) G/pat/command Execute command on lines containing pat
(except A, C, I, Q commands)
(1,$) X/pat/command Execute command on lines not containing pat
(except A, C, I, Q commands)
# ... Comment
$n Read or write temporary buffer, "n".
The error message "?" is printed whenever a command fails or is not
understood.
LIMITATIONS
o Files being edited can contain up to 6400 lines.
o When a global search and substitute combination fails, the entire
global search stops.
o Problems sometimes occur when removing or inserting NEWLINE
characters (via @n), especially in global commands.
RELATED TOPICS
More information is available. Type:
- HELP ED COMMANDS
for detailed information about each ED command.
- HELP PATTERNS
for information about the pattern-matching scheme.
- HELP CE
for information on creating and editing files interactively.
- HELP ED_DM
for information on the synonymous Display Manager command.