February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
The ed command is a line editing program.
Syntax
ed [-p string] [-s] [file]
Options
-p string sets the ed prompt to string.
-s suppresses diagnostics (which is useful for scripts).
Oddities
The default for string is null (no prompt).
Example
$ cat buzz
#! /bin/ksh
integer x=17
while :
do
x=17
done
$
$ ed buzz # Use ed to edit the buzz file
47 # Character count is automatically displayed
2 # Command 2 means display line 2
integer x=17
s/17/23/ # Changes the 17 to a 23
2 # Redisplay line 2
integer x=23
3 # Display line 3
while :
q
? # Editor displays a ? when confused
q # Quit the editor, (w saves changes)
$
$ cat -n buzz
1 #! /bin/ksh
2 integer x=17
3 while :
4 do
5 x=17
6 done
$
Read now
Unlock full access