date and time created 80/10/30 00:35:38 by mckusick
[unix-history] / .ref-BSD-3 / usr / doc / edtut / e7
CommitLineData
8340f87c
BJ
1.sp 2
2.SH
3Summary of Commands and Line Numbers
4.PP
5The general form of
6.ul
7ed
8commands is the command name,
9perhaps preceded by one or two line numbers, and,
10in the case of
11.UL e ,
12.UL r ,
13and
14.UL w ,
15followed by a file name.
16Only one command is allowed per line,
17but a
18.UL p
19command may follow any other command
20(except for
21.UL e ,
22.UL r ,
23.UL w
24and
25.UL q ).
26.LP
27.UL a :
28Append, that is,
29add lines to the buffer (at line dot, unless
30a different line is specified). Appending continues until
31\*.
32is typed on a new line.
33Dot is set to the last line appended.
34.LP
35.UL c :
36Change the specified lines to the new text which follows.
37The new lines are terminated by a
38\*.,
39as with
40.UL a .
41If no lines are specified,
42replace line dot.
43Dot is set to last line changed.
44.LP
45.UL d :
46Delete the lines specified.
47If none are specified, delete line dot.
48Dot is set to the first undeleted line,
49unless
50.UL $
51is deleted,
52in which case dot is set to
53.UL $ .
54.LP
55.UL e :
56Edit new file.
57Any previous
58contents of the buffer are thrown away,
59so issue a
60.UL w
61beforehand.
62.LP
63.UL f :
64Print remembered filename.
65If a name follows
66.UL f
67the remembered name will be set to it.
68.LP
69.UL g :
70The command
71.P1
72g/\(hy\(hy\(hy/commands
73.P2
74will execute the commands on those lines that contain
75.UL --- ,
76which can be any context search expression.
77.LP
78.UL i :
79Insert lines before specified line (or dot)
80until a
81\*.
82is typed on a new line.
83Dot is set to last line inserted.
84.LP
85.UL m :
86Move lines specified to after the line
87named after
88.UL m .
89Dot is set to the last line moved.
90.LP
91.UL p :
92Print specified lines.
93If none specified, print
94line dot.
95A single line number is equivalent to
96.IT line-number
97.UL p .
98A single return prints
99.UL .+1 ,
100the next line.
101.LP
102.UL q :
103Quit
104.IT ed .
105Wipes out all text in buffer
106if you give it twice in a row without first giving a
107.UL w
108command.
109.LP
110.UL r :
111Read a file into buffer (at end unless specified
112elsewhere.) Dot set to last line read.
113.LP
114.UL s :
115The command
116.P1
117s/string1/string2/
118.P2
119substitutes the characters
120.UL string1
121into
122.UL string2
123in the specified lines.
124If no lines are specified, make the substitution in line dot.
125Dot is set to last line in which a
126substitution took place, which means that if no substitution took place, dot is not changed.
127.UL s
128changes only the first occurrence of
129.UL string1
130on a line;
131to change all of them, type a
132.UL g
133after the final slash.
134.LP
135.UL v :
136The command
137.P1
138v/\(hy\(hy\(hy/commands
139.P2
140executes
141.UL commands
142on those lines that
143.ul
144do not
145contain
146.UL --- .
147.LP
148.UL w :
149Write out buffer onto a file.
150Dot is not changed.
151.LP
152.UL .= :
153Print value of dot.
154.UL = "" (
155by itself prints the value of
156.UL $ .)
157.LP
158.UL ! :
159The line
160.P1
161!command\(hyline
162.P2
163causes
164.UL command-line
165to be executed as a
166.UC UNIX
167command.
168.LP
169.UL /-----/ :
170Context search.
171Search for next line which contains
172this string of characters.
173Print it.
174Dot is set to the line where string
175was found.
176Search starts at
177.UL .+1 ,
178wraps around from
179.UL $
180to
1811,
182and continues to dot, if necessary.
183.LP
184.UL ?-----? :
185Context search in reverse direction.
186Start search
187at
188.UL .\-1 ,
189scan to 1,
190wrap around to
191.UL $ .