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