3 cfa37a7b 2004-04-10 devnull ed \- text editor
4 cfa37a7b 2004-04-10 devnull .SH SYNOPSIS
15 cfa37a7b 2004-04-10 devnull .SH DESCRIPTION
17 cfa37a7b 2004-04-10 devnull is a venerable text editor.
21 cfa37a7b 2004-04-10 devnull argument is given,
23 cfa37a7b 2004-04-10 devnull simulates an
25 cfa37a7b 2004-04-10 devnull command (see below) on that file:
26 cfa37a7b 2004-04-10 devnull it is read into
28 cfa37a7b 2004-04-10 devnull buffer so that it can be edited.
29 cfa37a7b 2004-04-10 devnull The options are
32 cfa37a7b 2004-04-10 devnull Suppress the printing
33 cfa37a7b 2004-04-10 devnull of character counts by
38 cfa37a7b 2004-04-10 devnull commands and of the confirming
42 cfa37a7b 2004-04-10 devnull commands.
45 cfa37a7b 2004-04-10 devnull (for output piping)
46 cfa37a7b 2004-04-10 devnull Write all output to the standard error file except writing by
48 cfa37a7b 2004-04-10 devnull commands.
51 cfa37a7b 2004-04-10 devnull is given, make
53 cfa37a7b 2004-04-10 devnull the remembered file; see the
55 cfa37a7b 2004-04-10 devnull command below.
58 cfa37a7b 2004-04-10 devnull operates on a `buffer', a copy of the file it is editing;
59 cfa37a7b 2004-04-10 devnull changes made
60 cfa37a7b 2004-04-10 devnull in the buffer have no effect on the file until a
63 cfa37a7b 2004-04-10 devnull command is given.
64 cfa37a7b 2004-04-10 devnull The copy of the text being edited resides
65 cfa37a7b 2004-04-10 devnull in a temporary file called the
66 cfa37a7b 2004-04-10 devnull .IR buffer .
68 cfa37a7b 2004-04-10 devnull Commands to
70 cfa37a7b 2004-04-10 devnull have a simple and regular structure: zero, one, or
72 cfa37a7b 2004-04-10 devnull .I addresses
73 cfa37a7b 2004-04-10 devnull followed by a single character
74 cfa37a7b 2004-04-10 devnull .IR command ,
76 cfa37a7b 2004-04-10 devnull followed by parameters to the command.
77 cfa37a7b 2004-04-10 devnull These addresses specify one or more lines in the buffer.
78 cfa37a7b 2004-04-10 devnull Missing addresses are supplied by default.
80 cfa37a7b 2004-04-10 devnull In general, only one command may appear on a line.
81 cfa37a7b 2004-04-10 devnull Certain commands allow the
82 cfa37a7b 2004-04-10 devnull addition of text to the buffer.
85 cfa37a7b 2004-04-10 devnull is accepting text, it is said
87 cfa37a7b 2004-04-10 devnull .I "input mode."
88 cfa37a7b 2004-04-10 devnull In this mode, no commands are recognized;
89 cfa37a7b 2004-04-10 devnull all input is merely collected.
90 cfa37a7b 2004-04-10 devnull Input mode is left by typing a period
92 cfa37a7b 2004-04-10 devnull alone at the
93 cfa37a7b 2004-04-10 devnull beginning of a line.
96 cfa37a7b 2004-04-10 devnull supports the
97 cfa37a7b 2004-04-10 devnull .I "regular expression"
98 cfa37a7b 2004-04-10 devnull notation described in
99 cfa37a7b 2004-04-10 devnull .IR regexp (6).
100 cfa37a7b 2004-04-10 devnull Regular expressions are used in addresses to specify
101 cfa37a7b 2004-04-10 devnull lines and in one command
105 cfa37a7b 2004-04-10 devnull to specify a portion of a line which is to be replaced.
106 cfa37a7b 2004-04-10 devnull If it is desired to use one of
107 cfa37a7b 2004-04-10 devnull the regular expression metacharacters as an ordinary
108 cfa37a7b 2004-04-10 devnull character, that character may be preceded by
109 cfa37a7b 2004-04-10 devnull .RB ` \e '.
110 cfa37a7b 2004-04-10 devnull This also applies to the character bounding the regular
111 cfa37a7b 2004-04-10 devnull expression (often
117 cfa37a7b 2004-04-10 devnull To understand addressing in
119 cfa37a7b 2004-04-10 devnull it is necessary to know that at any time there is a
120 cfa37a7b 2004-04-10 devnull .I "current line."
121 cfa37a7b 2004-04-10 devnull Generally, the current line is
122 cfa37a7b 2004-04-10 devnull the last line affected by a command; however,
123 cfa37a7b 2004-04-10 devnull the exact effect on the current line
124 cfa37a7b 2004-04-10 devnull is discussed under the description of
125 cfa37a7b 2004-04-10 devnull each command.
126 cfa37a7b 2004-04-10 devnull Addresses are constructed as follows.
129 cfa37a7b 2004-04-10 devnull The character
131 cfa37a7b 2004-04-10 devnull customarily called `dot',
132 cfa37a7b 2004-04-10 devnull addresses the current line.
135 cfa37a7b 2004-04-10 devnull The character
137 cfa37a7b 2004-04-10 devnull addresses the last line of the buffer.
140 cfa37a7b 2004-04-10 devnull A decimal number
142 cfa37a7b 2004-04-10 devnull addresses the
143 cfa37a7b 2004-04-10 devnull .IR n -th
144 cfa37a7b 2004-04-10 devnull line of the buffer.
148 cfa37a7b 2004-04-10 devnull addresses the line marked with the name
150 cfa37a7b 2004-04-10 devnull which must be a lower-case letter.
151 cfa37a7b 2004-04-10 devnull Lines are marked with the
153 cfa37a7b 2004-04-10 devnull command.
156 cfa37a7b 2004-04-10 devnull A regular expression enclosed in slashes (
158 cfa37a7b 2004-04-10 devnull addresses
159 cfa37a7b 2004-04-10 devnull the line found by searching forward from the current line
160 cfa37a7b 2004-04-10 devnull and stopping at the first line containing a
161 cfa37a7b 2004-04-10 devnull string that matches the regular expression.
162 cfa37a7b 2004-04-10 devnull If necessary the search wraps around to the beginning of the
166 cfa37a7b 2004-04-10 devnull A regular expression enclosed in queries
168 cfa37a7b 2004-04-10 devnull addresses
169 cfa37a7b 2004-04-10 devnull the line found by searching backward from the current line
170 cfa37a7b 2004-04-10 devnull and stopping at the first line containing
171 cfa37a7b 2004-04-10 devnull a string that matches the regular expression.
172 cfa37a7b 2004-04-10 devnull If necessary
173 cfa37a7b 2004-04-10 devnull the search wraps around to the end of the buffer.
176 cfa37a7b 2004-04-10 devnull An address followed by a plus sign
178 cfa37a7b 2004-04-10 devnull or a minus sign
180 cfa37a7b 2004-04-10 devnull followed by a decimal number specifies that address plus
181 cfa37a7b 2004-04-10 devnull (resp. minus) the indicated number of lines.
182 cfa37a7b 2004-04-10 devnull The plus sign may be omitted.
185 cfa37a7b 2004-04-10 devnull An address followed by
189 cfa37a7b 2004-04-10 devnull followed by a
190 cfa37a7b 2004-04-10 devnull regular expression enclosed in slashes specifies the first
191 cfa37a7b 2004-04-10 devnull matching line following (or preceding) that address.
192 cfa37a7b 2004-04-10 devnull The search wraps around if necessary.
195 cfa37a7b 2004-04-10 devnull may be omitted, so
197 cfa37a7b 2004-04-10 devnull addresses the
198 cfa37a7b 2004-04-10 devnull .I first
199 cfa37a7b 2004-04-10 devnull line in the buffer with an
201 cfa37a7b 2004-04-10 devnull Enclosing the regular expression in
203 cfa37a7b 2004-04-10 devnull reverses the search direction.
206 cfa37a7b 2004-04-10 devnull If an address begins with
210 cfa37a7b 2004-04-10 devnull the addition or subtraction is taken with respect to the current line;
213 cfa37a7b 2004-04-10 devnull is understood to mean
214 cfa37a7b 2004-04-10 devnull .LR .-5 .
217 cfa37a7b 2004-04-10 devnull If an address ends with
221 cfa37a7b 2004-04-10 devnull then 1 is added (resp. subtracted).
222 cfa37a7b 2004-04-10 devnull As a consequence of this rule and rule 9,
223 cfa37a7b 2004-04-10 devnull the address
225 cfa37a7b 2004-04-10 devnull refers to the line before the current line.
226 cfa37a7b 2004-04-10 devnull Moreover,
227 cfa37a7b 2004-04-10 devnull trailing
231 cfa37a7b 2004-04-10 devnull characters
232 cfa37a7b 2004-04-10 devnull have cumulative effect, so
234 cfa37a7b 2004-04-10 devnull refers to the current
235 cfa37a7b 2004-04-10 devnull line less 2.
238 cfa37a7b 2004-04-10 devnull To maintain compatibility with earlier versions of the editor,
239 cfa37a7b 2004-04-10 devnull the character
241 cfa37a7b 2004-04-10 devnull in addresses is
242 cfa37a7b 2004-04-10 devnull equivalent to
245 cfa37a7b 2004-04-10 devnull Commands may require zero, one, or two addresses.
246 cfa37a7b 2004-04-10 devnull Commands which require no addresses regard the presence
247 cfa37a7b 2004-04-10 devnull of an address as an error.
248 cfa37a7b 2004-04-10 devnull Commands which accept one or two addresses
249 cfa37a7b 2004-04-10 devnull assume default addresses when insufficient are given.
250 cfa37a7b 2004-04-10 devnull If more addresses are given than a command requires,
251 cfa37a7b 2004-04-10 devnull the last one or two (depending on what is accepted) are used.
253 cfa37a7b 2004-04-10 devnull Addresses are separated from each other typically by a comma
255 cfa37a7b 2004-04-10 devnull They may also be separated by a semicolon
257 cfa37a7b 2004-04-10 devnull In this case the current line
258 cfa37a7b 2004-04-10 devnull is set to
259 cfa37a7b 2004-04-10 devnull the previous address before the next address is interpreted.
260 cfa37a7b 2004-04-10 devnull If no address precedes a comma or semicolon, line 1 is assumed;
261 cfa37a7b 2004-04-10 devnull if no address follows, the last line of the buffer is assumed.
262 cfa37a7b 2004-04-10 devnull The second address of any two-address sequence
263 cfa37a7b 2004-04-10 devnull must correspond to a line following the line corresponding to the first address.
265 cfa37a7b 2004-04-10 devnull In the following list of
267 cfa37a7b 2004-04-10 devnull commands, the default addresses
268 cfa37a7b 2004-04-10 devnull are shown in parentheses.
269 cfa37a7b 2004-04-10 devnull The parentheses are not part of
270 cfa37a7b 2004-04-10 devnull the address, but are used to show that the given addresses are
271 cfa37a7b 2004-04-10 devnull the default.
272 cfa37a7b 2004-04-10 devnull `Dot' means the current line.
274 cfa37a7b 2004-04-10 devnull .RB (\|\fL.\fP\|) \|a
283 cfa37a7b 2004-04-10 devnull Read the given text
284 cfa37a7b 2004-04-10 devnull and append it after the addressed line.
285 cfa37a7b 2004-04-10 devnull Dot is left
286 cfa37a7b 2004-04-10 devnull on the last line input, if there
287 cfa37a7b 2004-04-10 devnull were any, otherwise at the addressed line.
290 cfa37a7b 2004-04-10 devnull is legal for this command; text is placed
291 cfa37a7b 2004-04-10 devnull at the beginning of the buffer.
293 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|b [ +- ][\fIpagesize\fP][ pln\fR]
295 cfa37a7b 2004-04-10 devnull Print a `page', normally 20 lines.
296 cfa37a7b 2004-04-10 devnull The optional
298 cfa37a7b 2004-04-10 devnull (default) or
300 cfa37a7b 2004-04-10 devnull specifies whether the next or previous
301 cfa37a7b 2004-04-10 devnull page is to be printed.
302 cfa37a7b 2004-04-10 devnull The optional
303 cfa37a7b 2004-04-10 devnull .I pagesize
304 cfa37a7b 2004-04-10 devnull is the number of lines in a page.
305 cfa37a7b 2004-04-10 devnull The optional
310 cfa37a7b 2004-04-10 devnull causes printing in the specified format, initially
312 cfa37a7b 2004-04-10 devnull Pagesize and format are remembered between
314 cfa37a7b 2004-04-10 devnull commands.
315 cfa37a7b 2004-04-10 devnull Dot is left at the last line displayed.
317 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|c
327 cfa37a7b 2004-04-10 devnull Delete the addressed lines, then accept input
328 cfa37a7b 2004-04-10 devnull text to replace these lines.
329 cfa37a7b 2004-04-10 devnull Dot is left at the last line input; if there were none,
330 cfa37a7b 2004-04-10 devnull it is left at the line preceding the deleted lines.
332 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|d
333 cfa37a7b 2004-04-10 devnull Delete the addressed lines from the buffer.
334 cfa37a7b 2004-04-10 devnull Dot is set to the line following the last line deleted, or to
335 cfa37a7b 2004-04-10 devnull the last line of the buffer if the deleted lines had no successor.
337 cfa37a7b 2004-04-10 devnull .BI e " filename"
339 cfa37a7b 2004-04-10 devnull Delete the entire contents of the buffer;
340 cfa37a7b 2004-04-10 devnull then read the named file into the buffer.
341 cfa37a7b 2004-04-10 devnull Dot is set to the last line of the buffer.
342 cfa37a7b 2004-04-10 devnull The number of characters read is typed.
343 cfa37a7b 2004-04-10 devnull The file name is remembered for possible use in later
348 cfa37a7b 2004-04-10 devnull commands.
350 cfa37a7b 2004-04-10 devnull .I filename
351 cfa37a7b 2004-04-10 devnull is missing, the remembered name is used.
353 cfa37a7b 2004-04-10 devnull .BI E " filename"
354 cfa37a7b 2004-04-10 devnull Unconditional
357 cfa37a7b 2004-04-10 devnull .RL ` q '
360 cfa37a7b 2004-04-10 devnull .BI f " filename"
361 cfa37a7b 2004-04-10 devnull Print the currently remembered file name.
363 cfa37a7b 2004-04-10 devnull .I filename
364 cfa37a7b 2004-04-10 devnull is given,
365 cfa37a7b 2004-04-10 devnull the currently remembered file name is first changed to
366 cfa37a7b 2004-04-10 devnull .IR filename .
368 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|g/\fIregular\ expression\fP/\fIcommand\ list\fP
371 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|g/\fIregular\ expression\fP/
373 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|g/\fIregular\ expression\fP
376 cfa37a7b 2004-04-10 devnull First mark every line which matches
377 cfa37a7b 2004-04-10 devnull the given
378 cfa37a7b 2004-04-10 devnull .IR regular expression .
379 cfa37a7b 2004-04-10 devnull Then for every such line, execute the
380 cfa37a7b 2004-04-10 devnull .I command list
381 cfa37a7b 2004-04-10 devnull with dot initially set to that line.
382 cfa37a7b 2004-04-10 devnull A single command or the first of multiple commands
383 cfa37a7b 2004-04-10 devnull appears on the same line with the global command.
384 cfa37a7b 2004-04-10 devnull All lines of a multi-line list except the last line must end with
385 cfa37a7b 2004-04-10 devnull .LR \e .
387 cfa37a7b 2004-04-10 devnull .RB \&` \&. \&'
388 cfa37a7b 2004-04-10 devnull terminating input mode for an
392 cfa37a7b 2004-04-10 devnull command may be omitted if it would be on the
393 cfa37a7b 2004-04-10 devnull last line of the command list.
394 cfa37a7b 2004-04-10 devnull The commands
398 cfa37a7b 2004-04-10 devnull are not permitted in the command list.
399 cfa37a7b 2004-04-10 devnull Any character other than space or newline may
400 cfa37a7b 2004-04-10 devnull be used instead of
402 cfa37a7b 2004-04-10 devnull to delimit the regular expression.
403 cfa37a7b 2004-04-10 devnull The second and third forms mean
404 cfa37a7b 2004-04-10 devnull .BI g/ regular\ expression /p \f1.
406 cfa37a7b 2004-04-10 devnull .RB (\| .\| ) \|i
412 cfa37a7b 2004-04-10 devnull Insert the given text before the addressed line.
413 cfa37a7b 2004-04-10 devnull Dot is left at the last line input, or, if there were none,
414 cfa37a7b 2004-04-10 devnull at the line before the addressed line.
415 cfa37a7b 2004-04-10 devnull This command differs from the
417 cfa37a7b 2004-04-10 devnull command only in the placement of the
421 cfa37a7b 2004-04-10 devnull .RB (\| .,.+1 \|) \|j
422 cfa37a7b 2004-04-10 devnull Join the addressed lines into a single line;
423 cfa37a7b 2004-04-10 devnull intermediate newlines are deleted.
424 cfa37a7b 2004-04-10 devnull Dot is left at the resulting line.
426 cfa37a7b 2004-04-10 devnull .RB (\|\fL.\fP\|) \|k\fIx\fP
427 cfa37a7b 2004-04-10 devnull Mark the addressed line with name
429 cfa37a7b 2004-04-10 devnull which must be a lower-case letter.
430 cfa37a7b 2004-04-10 devnull The address form
431 cfa37a7b 2004-04-10 devnull .BI \' x
432 cfa37a7b 2004-04-10 devnull then addresses this line.
435 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|l
437 cfa37a7b 2004-04-10 devnull Print the addressed lines in an unambiguous way:
438 cfa37a7b 2004-04-10 devnull a tab is printed as
439 cfa37a7b 2004-04-10 devnull .LR \et ,
440 cfa37a7b 2004-04-10 devnull a backspace as
441 cfa37a7b 2004-04-10 devnull .LR \eb ,
442 cfa37a7b 2004-04-10 devnull backslashes as
443 cfa37a7b 2004-04-10 devnull .LR \e\e ,
444 cfa37a7b 2004-04-10 devnull and non-printing characters as
445 cfa37a7b 2004-04-10 devnull a backslash, an
447 cfa37a7b 2004-04-10 devnull and four hexadecimal digits.
448 cfa37a7b 2004-04-10 devnull Long lines are folded,
449 cfa37a7b 2004-04-10 devnull with the second and subsequent sub-lines indented one tab stop.
450 cfa37a7b 2004-04-10 devnull If the last character in the line is a blank,
451 cfa37a7b 2004-04-10 devnull it is followed by
452 cfa37a7b 2004-04-10 devnull .LR \en .
455 cfa37a7b 2004-04-10 devnull may be appended, like
457 cfa37a7b 2004-04-10 devnull to any non-I/O command.
459 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|m\fIa
461 cfa37a7b 2004-04-10 devnull Reposition the addressed lines after the line
462 cfa37a7b 2004-04-10 devnull addressed by
464 cfa37a7b 2004-04-10 devnull Dot is left at the last moved line.
466 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|n
470 cfa37a7b 2004-04-10 devnull prefixing each line with its line number and a tab.
473 cfa37a7b 2004-04-10 devnull may be appended, like
475 cfa37a7b 2004-04-10 devnull to any non-I/O command.
477 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|p
478 cfa37a7b 2004-04-10 devnull Print the addressed lines.
479 cfa37a7b 2004-04-10 devnull Dot is left at the last line printed.
482 cfa37a7b 2004-04-10 devnull appended to any non-I/O command causes the then current line
483 cfa37a7b 2004-04-10 devnull to be printed after the command is executed.
485 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|P
486 cfa37a7b 2004-04-10 devnull This command is a synonym for
490 cfa37a7b 2004-04-10 devnull Quit the editor.
491 cfa37a7b 2004-04-10 devnull No automatic write
492 cfa37a7b 2004-04-10 devnull of a file is done.
497 cfa37a7b 2004-04-10 devnull command is considered to be in error if the buffer has
498 cfa37a7b 2004-04-10 devnull been modified since the last
503 cfa37a7b 2004-04-10 devnull command.
506 cfa37a7b 2004-04-10 devnull Quit unconditionally.
508 cfa37a7b 2004-04-10 devnull .RB ( $ )\|r\ \fIfilename\fP
509 cfa37a7b 2004-04-10 devnull Read in the given file after the addressed line.
511 cfa37a7b 2004-04-10 devnull .I filename
512 cfa37a7b 2004-04-10 devnull is given, the remembered file name is used.
513 cfa37a7b 2004-04-10 devnull The file name is remembered if there were no
514 cfa37a7b 2004-04-10 devnull remembered file name already.
515 cfa37a7b 2004-04-10 devnull If the read is successful, the number of characters
516 cfa37a7b 2004-04-10 devnull read is printed.
517 cfa37a7b 2004-04-10 devnull Dot is left at the last line read from the file.
519 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|s\fIn\fP/\fIregular\ expression\fP/\fIreplacement\fP/
522 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|s\fIn\fP/\fIregular\ expression\fP/\fIreplacement\fP/g
524 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|s\fIn\fP/\fIregular\ expression\fP/\fIreplacement\fP
526 cfa37a7b 2004-04-10 devnull Substitute.
527 cfa37a7b 2004-04-10 devnull Search each addressed
528 cfa37a7b 2004-04-10 devnull line for an occurrence of the specified regular expression.
529 cfa37a7b 2004-04-10 devnull On each line in which
531 cfa37a7b 2004-04-10 devnull matches are found
533 cfa37a7b 2004-04-10 devnull defaults to 1 if missing),
535 cfa37a7b 2004-04-10 devnull .IR n th
536 cfa37a7b 2004-04-10 devnull matched string is replaced by the replacement specified.
537 cfa37a7b 2004-04-10 devnull If the global replacement indicator
539 cfa37a7b 2004-04-10 devnull appears after the command,
540 cfa37a7b 2004-04-10 devnull all subsequent matches on the line are also replaced.
541 cfa37a7b 2004-04-10 devnull It is an error for the substitution to fail on all addressed lines.
542 cfa37a7b 2004-04-10 devnull Any character other than space or newline
543 cfa37a7b 2004-04-10 devnull may be used instead of
545 cfa37a7b 2004-04-10 devnull to delimit the regular expression
546 cfa37a7b 2004-04-10 devnull and the replacement.
547 cfa37a7b 2004-04-10 devnull Dot is left at the last line substituted.
548 cfa37a7b 2004-04-10 devnull The third form means
549 cfa37a7b 2004-04-10 devnull .BI s n / regular\ expression / replacement\fP/p\f1.
550 cfa37a7b 2004-04-10 devnull The second
552 cfa37a7b 2004-04-10 devnull may be omitted if the replacement is
555 cfa37a7b 2004-04-10 devnull An ampersand
557 cfa37a7b 2004-04-10 devnull appearing in the replacement
558 cfa37a7b 2004-04-10 devnull is replaced by the string matching the regular expression.
559 cfa37a7b 2004-04-10 devnull The characters
560 cfa37a7b 2004-04-10 devnull .BI \e n\f1,
563 cfa37a7b 2004-04-10 devnull is a digit,
564 cfa37a7b 2004-04-10 devnull are replaced by the text matched by the
565 cfa37a7b 2004-04-10 devnull .IR n -th
566 cfa37a7b 2004-04-10 devnull regular subexpression
567 cfa37a7b 2004-04-10 devnull enclosed between
572 cfa37a7b 2004-04-10 devnull nested parenthesized subexpressions
573 cfa37a7b 2004-04-10 devnull are present,
575 cfa37a7b 2004-04-10 devnull is determined by counting occurrences of
577 cfa37a7b 2004-04-10 devnull starting from the left.
579 cfa37a7b 2004-04-10 devnull A literal
583 cfa37a7b 2004-04-10 devnull or newline may be included in a replacement
584 cfa37a7b 2004-04-10 devnull by prefixing it with
585 cfa37a7b 2004-04-10 devnull .LR \e .
587 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|t\|\fIa
588 cfa37a7b 2004-04-10 devnull Transfer.
589 cfa37a7b 2004-04-10 devnull Copy the addressed lines
590 cfa37a7b 2004-04-10 devnull after the line addressed by
592 cfa37a7b 2004-04-10 devnull Dot is left at the last line of the copy.
594 cfa37a7b 2004-04-10 devnull .RB (\|\fL.,.\fP\|) \|u
596 cfa37a7b 2004-04-10 devnull Restore the preceding contents
597 cfa37a7b 2004-04-10 devnull of the first addressed line (sic), which must be the last line
598 cfa37a7b 2004-04-10 devnull in which a substitution was made (double sic).
600 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|v/\fIregular\ expression\fP/\fIcommand\ list\fP
601 cfa37a7b 2004-04-10 devnull This command is the same as the global command
603 cfa37a7b 2004-04-10 devnull except that the command list is executed with
604 cfa37a7b 2004-04-10 devnull dot initially set to every line
605 cfa37a7b 2004-04-10 devnull .I except
607 cfa37a7b 2004-04-10 devnull matching the regular expression.
609 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|w " \fIfilename\fP"
610 cfa37a7b 2004-04-10 devnull Write the addressed lines to
611 cfa37a7b 2004-04-10 devnull the given file.
612 cfa37a7b 2004-04-10 devnull If the file does not exist,
613 cfa37a7b 2004-04-10 devnull it is created with mode 666 (readable and writable by everyone).
615 cfa37a7b 2004-04-10 devnull .I filename
616 cfa37a7b 2004-04-10 devnull is given, the remembered file name, if any, is used.
617 cfa37a7b 2004-04-10 devnull The file name is remembered if there were no
618 cfa37a7b 2004-04-10 devnull remembered file name already.
619 cfa37a7b 2004-04-10 devnull Dot is unchanged.
620 cfa37a7b 2004-04-10 devnull If the write is successful, the number of characters written is
621 cfa37a7b 2004-04-10 devnull printed.
623 cfa37a7b 2004-04-10 devnull .RB (\|\fL1,$\fP\|) \|W " \fIfilename\fP"
626 cfa37a7b 2004-04-10 devnull but append to, instead of overwriting, any existing file contents.
628 cfa37a7b 2004-04-10 devnull .RB ( $ ) \|=
629 cfa37a7b 2004-04-10 devnull Print the line number of the addressed line.
630 cfa37a7b 2004-04-10 devnull Dot is unchanged.
632 cfa37a7b 2004-04-10 devnull .BI ! shell\ command
633 cfa37a7b 2004-04-10 devnull Send the remainder of the line after the
636 cfa37a7b 2004-04-10 devnull .IR rc (1)
637 cfa37a7b 2004-04-10 devnull to be interpreted as a command.
638 cfa37a7b 2004-04-10 devnull Dot is unchanged.
640 cfa37a7b 2004-04-10 devnull .RB (\| .+1 )\|<newline>
641 cfa37a7b 2004-04-10 devnull An address without a command is taken as a
643 cfa37a7b 2004-04-10 devnull command.
644 cfa37a7b 2004-04-10 devnull A terminal
646 cfa37a7b 2004-04-10 devnull may be omitted from the address.
647 cfa37a7b 2004-04-10 devnull A blank line alone is equivalent to
648 cfa37a7b 2004-04-10 devnull .LR .+1p ;
649 cfa37a7b 2004-04-10 devnull it is useful
650 cfa37a7b 2004-04-10 devnull for stepping through text.
652 cfa37a7b 2004-04-10 devnull If an interrupt signal
653 cfa37a7b 2004-04-10 devnull .SM (DEL)
654 cfa37a7b 2004-04-10 devnull is sent,
656 cfa37a7b 2004-04-10 devnull prints a
658 cfa37a7b 2004-04-10 devnull and returns to its command level.
660 cfa37a7b 2004-04-10 devnull When reading a file,
662 cfa37a7b 2004-04-10 devnull discards
664 cfa37a7b 2004-04-10 devnull characters
665 cfa37a7b 2004-04-10 devnull and all characters after the last newline.
666 cfa37a7b 2004-04-10 devnull .SH FILES
667 cfa37a7b 2004-04-10 devnull .B /tmp/e*
669 cfa37a7b 2004-04-10 devnull .B ed.hup
670 cfa37a7b 2004-04-10 devnull \ \ work is saved here if terminal hangs up
671 cfa37a7b 2004-04-10 devnull .SH SOURCE
672 b5fdffee 2004-04-19 devnull .B /usr/local/plan9/src/cmd/ed.c
673 cfa37a7b 2004-04-10 devnull .SH "SEE ALSO"
674 cfa37a7b 2004-04-10 devnull .IR sam (1),
675 cfa37a7b 2004-04-10 devnull .IR sed (1),
676 cfa37a7b 2004-04-10 devnull .IR regexp (6)
677 cfa37a7b 2004-04-10 devnull .SH DIAGNOSTICS
678 cfa37a7b 2004-04-10 devnull .BI ? name
679 cfa37a7b 2004-04-10 devnull for inaccessible file;
681 cfa37a7b 2004-04-10 devnull for temporary file overflow;
683 cfa37a7b 2004-04-10 devnull for errors in commands or other overflows.