heirloom-ed

view ed.1 @ 2:a09d0630f05b

removed unnecessary command line options
author markus schnalke <meillo@marmaro.de>
date Tue, 12 Aug 2014 18:08:24 +0200
parents 1493bea5ac22
children ac52712b2b5e
line source
1 '\" t
2 .\" Sccsid @(#)ed.1 1.48 (gritter) 6/22/05
3 .\" Parts taken from ed(1), Unix 7th edition:
4 .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" Redistributions of source code and documentation must retain the
10 .\" above copyright notice, this list of conditions and the following
11 .\" disclaimer.
12 .\" Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed or owned by Caldera
18 .\" International, Inc.
19 .\" Neither the name of Caldera International, Inc. nor the names of
20 .\" other contributors may be used to endorse or promote products
21 .\" derived from this software without specific prior written permission.
22 .\"
23 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
24 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
25 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
28 .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
34 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 .TH ED 1 "6/22/05" "Heirloom Toolchest" "User Commands"
36 .if t .ds q \(aa
37 .if n .ds q '
38 .SH NAME
39 ed \- text editor
40 .SH SYNOPSIS
41 \fBed\fR [\fB\-\fR\] [\fIname\fR]
42 .SH DESCRIPTION
43 .I Ed
44 is the standard text editor.
45 .PP
46 If a
47 .I name
48 argument is given,
49 .I ed
50 simulates an
51 .I e
52 command (see below)\| on the named file; that is to say,
53 the file is read into
54 .IR ed 's
55 buffer so that it can be edited.
56 The optional
57 .B \-
58 suppresses the printing
59 of character counts by
60 .IR e ,
61 .IR r ,
62 and
63 .I w
64 commands,
65 and of the `!' after completion of a shell command.
66 .PP
67 .I Ed
68 operates on a copy of any file it is editing; changes made
69 in the copy have no effect on the file until a
70 .IR w ""
71 (write)\|
72 command is given.
73 The copy of the text being edited resides
74 in a temporary file called the
75 .IR buffer .
76 .PP
77 The editor supports format specifications as defined in
78 .IR fspec (5).
79 If the terminal is configured to expand tabulators
80 (as enabled with
81 .I stty tab3
82 or
83 .IR "stty \-tabs"),
84 and the first line of the file being edited
85 contains a format specification,
86 the
87 .I t
88 and
89 .I s
90 are interpreted,
91 that is, tabulators are expanded and lines are truncated
92 when printing to the terminal. For example,
93 .RS
94 <:t\-f s72:>
95 .sp
96 .RE
97 selects FORTRAN format and truncates lines at 72 characters.
98 No expansion or truncation is performed by
99 .I ed
100 when input is typed to the terminal.
101 .PP
102 Commands to
103 .I ed
104 have a simple and regular structure: zero or
105 more
106 .I addresses
107 followed by a single character
108 .I command,
109 possibly
110 followed by parameters to the command.
111 These addresses specify one or more lines in the buffer.
112 Missing addresses are supplied by default.
113 .PP
114 In general, only one command may appear on a line.
115 Certain commands allow the
116 addition of text to the buffer.
117 While
118 .I ed
119 is accepting text, it is said
120 to be in
121 .I "input mode."
122 In this mode, no commands are recognized;
123 all input is merely collected.
124 Input mode is left by typing a period `\fB.\fR' alone at the
125 beginning of a line.
126 .PP
127 .I Ed
128 supports a limited form of
129 .I "regular expression"
130 notation.
131 A regular expression specifies
132 a set of strings of characters.
133 A member of this set of strings is said to be
134 .I matched
135 by the regular expression.
136 In the following specification for regular expressions
137 the word `character' means any character but newline.
138 .B ed
139 uses simple regular expressions.
140 .SS "Simple Regular Expressions"
141 .IP 1.
142 Any character except a special character
143 matches itself.
144 Special characters are
145 the regular expression delimiter plus
146 .RB \e\|[\| .
147 and sometimes ^\|*\|$.
148 .IP 2.
149 A
150 .B .\&
151 matches any character.
152 .IP 3.
153 A \fB\e\fR followed by any character except a digit
154 or (\|) {\|} <\|> matches that character.
155 .IP 4.
156 A nonempty string
157 .I s
158 bracketed
159 \fB[\fI\|s\|\fB]\fR
160 (or
161 \fB[^\fIs\|\fB]\fR)
162 forms a \fIbracket expression\fR that
163 matches any character in (or not in)
164 .I s.
165 In
166 .I s,
167 \e has no special meaning, and ] may only appear as
168 the first letter.
169 A substring
170 \fIa\fB\-\fIb\fR,
171 with
172 .I a
173 and
174 .I b
175 in ascending ASCII order, stands for the inclusive
176 range of ASCII characters.
177 .IP 5.
178 A regular expression of form 1-4 followed by \fB*\fR matches a sequence of
179 0 or more matches of the regular expression.
180 .IP 6.
181 A regular expression of form 1-4
182 followed by \fB\e{\fIm\fB,\fIn\fB\e}\fR
183 forms an \fIinterval expression\fR that
184 matches a sequence of \fIm\fR through \fIn\fR matches, inclusive,
185 of the regular expression.
186 The values of \fIm\fR and \fIn\fR must be non-negative
187 and smaller than 256.
188 The form \fB\e{\fIm\fB\e}\fR matches exactly \fIm\fR occurrences,
189 \fB\e{\fIm\fB,\e}\fR matches at least \fIm\fR occurrences.
190 .IP 7.
191 The sequence \fB\e<\fR forces the match
192 to occur only at the beginning of a ``variable'' or ``word'';
193 that is, either at the beginning of a line,
194 or just before a letter, digit or underline
195 and after a character not one of these.
196 .IP 8.
197 The sequence \fB\e>\fR matches the end
198 of a ``variable'' or ``word'',
199 i.\|e. either the end of the line
200 or before character which is neither a letter,
201 nor a digit, nor the underline character.
202 .IP 9.
203 A regular expression,
204 .I x,
205 of form 1-11, parenthesized
206 \fB\e(\fI\|x\|\fB\e)\fR
207 is called a \fIsubexpression\fR and
208 matches what
209 .I x
210 matches.
211 .IP 10.
212 A \fB\e\fR followed by a digit
213 .I n
214 forms a \fIbackreference\fR and
215 matches a copy of the string that the
216 parenthesized regular expression beginning with the
217 .IR n th
218 \e( matched.
219 .IP 11.
220 A regular expression of form 1-11,
221 .I x,
222 followed by a regular expression of form 1-10,
223 .I y
224 matches a match for
225 .I x
226 followed by a match for
227 .I y,
228 with the
229 .I x
230 match being as long as possible while still permitting a
231 .I y
232 match.
233 .IP 12.
234 A regular expression of form 1-11 preceded by \fB^\fR
235 (or followed by \fB$\fR), is constrained to matches that
236 begin at the left (or end at the right) end of a line
237 (\fIanchoring\fR).
238 .IP 13.
239 A regular expression of form 1-12 picks out the
240 longest among the leftmost matches in a line.
241 .IP 14.
242 An empty regular expression stands for a copy of the
243 last regular expression encountered.
244 .PP
245 Regular expressions are used in addresses to specify
246 lines and in one command
247 (see
248 .I s
249 below)\|
250 to specify a portion of a line which is to be replaced.
251 If it is desired to use one of
252 the regular expression metacharacters as an ordinary
253 character, that character may be preceded by `\e'.
254 This also applies to the character bounding the regular
255 expression (often `/')\| and to `\e' itself.
256 .PP
257 To understand addressing in
258 .I ed
259 it is necessary to know that at any time there is a
260 .I "current line."
261 Generally speaking, the current line is
262 the last line affected by a command; however,
263 the exact effect on the current line
264 is discussed under the description of
265 the command.
266 Addresses are constructed as follows.
267 .TP
268 1.
269 The character `\fB.\fR' addresses the current line.
270 .TP
271 2.
272 The character `\fB$\fR' addresses the last line of the buffer.
273 .TP
274 3.
275 A decimal number
276 .I n
277 addresses the
278 .IR n -th
279 line of the buffer.
280 .TP
281 4.
282 `\fB\(fm\fIx\fR' addresses the line marked with the name
283 .IR x ,
284 which must be a lower-case letter.
285 Lines are marked with the
286 .I k
287 command described below.
288 .TP
289 5.
290 A regular expression enclosed in slashes `\fB/\fR' addresses
291 the line found by searching forward from the current line
292 and stopping at the first line containing a
293 string that matches the regular expression.
294 If necessary the search wraps around to the beginning of the
295 buffer.
296 .TP
297 6.
298 A regular expression enclosed in queries `\fB?\fR' addresses
299 the line found by searching backward from the current line
300 and stopping at the first line containing
301 a string that matches the regular expression.
302 If necessary
303 the search wraps around to the end of the buffer.
304 .TP
305 7.
306 An address followed by a plus sign `\fB+\fR'
307 or a minus sign `\fB\-\fR' followed by a decimal number
308 specifies that address plus
309 (resp. minus)\| the indicated number of lines.
310 The plus sign may be omitted.
311 .TP
312 8.
313 If an address begins with `\fB+\fR' or `\fB\-\fR'
314 the addition or subtraction is taken with respect to the current line;
315 e.g. `\-5' is understood to mean `\fB.\fR\-5'.
316 .TP
317 9.
318 If an address ends with `\fB+\fR' or `\fB\-\fR',
319 then 1 is added (resp. subtracted).
320 As a consequence of this rule and rule 8,
321 the address `\-' refers to the line before the current line.
322 Moreover,
323 trailing
324 `+' and `\-' characters
325 have cumulative effect, so `\-\-' refers to the current
326 line less 2.
327 .TP
328 10.
329 To maintain compatibility with earlier versions of the editor,
330 the character `\fB^\fR' in addresses is
331 equivalent to `\-'.
332 .PP
333 Commands may require zero, one, or two addresses.
334 Commands which require no addresses regard the presence
335 of an address as an error.
336 Commands which accept one or two addresses
337 assume default addresses when insufficient are given.
338 If more addresses are given than such a command requires,
339 the last one or two (depending on what is accepted)\| are used.
340 .PP
341 Addresses are separated from each other typically by a comma
342 `\fB,\fR'.
343 They may also be separated by a semicolon
344 `\fB;\fR'.
345 In this case the current line `\fB.\fR' is set to
346 the previous address before the next address is interpreted.
347 This feature can be used to determine the starting
348 line for forward and backward searches (`/', `?')\|.
349 The second address of any two-address sequence
350 must correspond to a line following the line corresponding to the first address.
351 .PP
352 Omission of the first address causes
353 the first line to be used with `,',
354 or the current line with `;', respectively;
355 if the second address is also omitted,
356 the last line of the buffer is used.
357 Thus a single `,' specifies the entire contents of the buffer,
358 and a single `;' specifies the contents
359 ranging from the current line to the last one.
360 .PP
361 In the following list of
362 .I ed
363 commands, the default addresses
364 are shown in parentheses.
365 The parentheses are not part of
366 the address, but are used to show that the given addresses are
367 the default.
368 .PP
369 As mentioned, it is generally illegal for more than one
370 command to appear on a line.
371 However, most commands may be suffixed by `p', `l', or `n',
372 in which case
373 the current line is either
374 printed, listed, or numbered respectively
375 in the way discussed below.
376 .TP 5
377 \fR(\|\fI.\|\fR)\fB\|a\fR
378 .br
379 .ns
380 .TP 5
381 <text>
382 .br
383 .ns
384 .TP 5
385 .B .
386 .br
387 The append command reads the given text
388 and appends it after the addressed line.
389 `\fB.\fR' is left
390 on the last line input, if there
391 were any, otherwise at the addressed line.
392 Address `0' is legal for this command; text is placed
393 at the beginning of the buffer.
394 .TP 5
395 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBc\fR
396 .br
397 .ns
398 .TP 5
399 <text>
400 .br
401 .ns
402 .TP 5
403 .B .
404 .br
405 The change
406 command deletes the addressed lines, then accepts input
407 text which replaces these lines.
408 `\fB.\fR' is left at the last line input; if there were none,
409 it is left at the line preceding the deleted lines.
410 .TP 5
411 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBd\fR
412 The delete command deletes the addressed lines from the buffer.
413 The line originally after the last line deleted becomes the current line;
414 if the lines deleted were originally at the end,
415 the new last line becomes the current line.
416 .TP 5
417 \fBe\ \fIfilename\fR
418 The edit
419 command causes the entire contents of the buffer to be deleted,
420 and then the named file to be read in.
421 `\fB.\fR' is set to the last line of the buffer.
422 The number of characters read is typed.
423 `\fIfilename\fR' is remembered for possible use as a default file name
424 in a subsequent
425 .I r
426 or
427 .I w
428 command.
429 If `\fIfilename\fR' is missing, the remembered name is used.
430 A `\fIfilename\fR' starting with a `\fB!\fR'
431 causes the output of the shell command following this character
432 to be read in.
433 .TP 5
434 \fBE\ \fIfilename\fR
435 This command is the same as
436 .IR e ,
437 except that no diagnostic results when no
438 .I w
439 has been given since the last buffer alteration.
440 .TP 5
441 \fBf\ \fIfilename\fR
442 The filename command prints the currently remembered file name.
443 If `\fIfilename\fR' is given,
444 the currently remembered file name is changed to `\fIfilename\fR'.
445 .TP 5
446 \fR(\fI1\fB,\fI$\fR)\|\fBg/\fIregular expression\fB/\fIcommand list\fR
447 In the global
448 command, the first step is to mark every line which matches
449 the given \fIregular expression\fR.
450 Then for every such line, the
451 given \fIcommand list\fR is executed
452 with `\fB.\fR' initially set to that line.
453 A single command or the first of multiple commands
454 appears on the same line with the global command.
455 All lines of a multi-line list except the last line must be ended with `\e'.
456 .I A,
457 .I i,
458 and
459 .I c
460 commands and associated input are permitted;
461 the `\fB.\fR' terminating input mode may be omitted if it would be on the
462 last line of the command list.
463 The commands
464 .I g
465 and
466 .I v
467 are not permitted in the command list.
468 .TP 5
469 \fR(\fI1\fB,\fI$\fR)\|\fBG/\fIregular expression\fB/\fR
470 The interactive global command
471 first marks every line matching the given \fIregular expression\fR.
472 Then each line is printed
473 and a command is read and executed for this line.
474 A single newline character causes the line to remain unchanged,
475 an isolated `\fB&\fR' repeats the command given for the previous line.
476 The command can be terminated by an interrupt signal.
477 .TP 5
478 .B h
479 This command prints a verbose description for the
480 last error encountered.
481 .TP
482 .B H
483 This command acts like the
484 .I h
485 command,
486 but also causes verbose descriptions to be printed
487 on all following error conditions.
488 Another
489 .I H
490 turns verbose mode off.
491 .TP 5
492 \fR(\|\fI.\|\fR)\|\fBi\fR
493 .br
494 .ns
495 .TP 5
496 <text>
497 .br
498 .ns
499 .TP 5
500 .B .
501 .br
502 This command inserts the given text before the addressed line.
503 `\fB.\fR' is left at the last line input, or, if there were none,
504 at the line before the addressed line.
505 This command differs from the
506 .I a
507 command only in the placement of the
508 text.
509 .TP 5
510 \fR(\|\fI.\|\fB,\|\fI.+1\fR)\|\fBj\fR
511 This command joins the addressed lines into a single line;
512 intermediate newlines simply disappear.
513 `\fB.\fR' is left at the resulting line.
514 .TP 5
515 \fR(\fI.\fR)\|\fBk\fIx\fR
516 The mark command marks the addressed line with
517 name
518 .IR x ,
519 which must be a lower-case letter.
520 The address form `\(fm\fIx\fR' then addresses this line.
521 .ne 2.5
522 .TP 5
523 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBl\fR
524 The list command
525 prints the addressed lines in an unambiguous way:
526 non-graphic control characters are printed in three-digit octal;
527 Long lines are folded.
528 The
529 .I l
530 command may be placed on the same line after any non-i/o
531 command.
532 .TP 5
533 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBm\fIa\fR
534 The move command repositions the addressed lines after the line
535 addressed by
536 .IR a .
537 The last of the moved lines becomes the current line.
538 .TP 5
539 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBn\fR
540 This command prints lines preceded by their line numbers.
541 It otherwise acts like the
542 .I p
543 command described below.
544 .TP 5
545 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBp\fR
546 The print command prints the addressed lines.
547 `\fB.\fR'
548 is left at the last line printed.
549 The
550 .I p
551 command
552 may
553 be placed on the same line after any non-i/o command.
554 .TP
555 .B P
556 This command causes a prompt to be printed
557 before following commands are read.
558 The default prompt is a `*' character.
559 Another
560 .I P
561 disables the prompt.
562 .TP 5
563 .B q
564 The quit command causes
565 .I ed
566 to exit.
567 No automatic write
568 of a file is done.
569 .TP 5
570 .B Q
571 This command is the same as
572 .I q,
573 except that no diagnostic results when no
574 .I w
575 has been given since the last buffer alteration.
576 .TP 5
577 \fR(\fI$\fR)\|\fBr\ \fIfilename\fR
578 The read command
579 reads in the given file after the addressed line.
580 If no file name is given,
581 the remembered file name, if any, is used
582 (see
583 .I e
584 and
585 .I f
586 commands)\|.
587 The file name is remembered if there was no
588 remembered file name already.
589 Address `0' is legal for
590 .I r
591 and causes the
592 file to be read at the beginning of the buffer.
593 If the read is successful, the number of characters
594 read is typed.
595 `\fB.\fR' is left at the last line read in from the file.
596 A `filename' starting with a `\fB!\fR'
597 causes the output of the shell command following this character
598 to be read in.
599 .TP 5
600 \fR(\|\fI.\fB\|,\|\fI.\fR\|)\|\fBs/\fIregular expression\fB/\fIreplacement\fB/\fR or,
601 .br
602 .ns
603 .TP 5
604 \fR(\|\fI.\fB\|,\|\fI.\fR\|)\|\fBs/\fIregular expression\fB/\fIreplacement\fB/g\fR or,
605 .br
606 .ns
607 .TP 5
608 \fR(\|\fI.\fB\|,\|\fI.\fR\|)\|\fBs/\fIregular expression\fB/\fIreplacement\fB/\fInumber\fR
609 The substitute command searches each addressed
610 line for an occurrence of the specified regular expression.
611 On each line in which a match is found,
612 all matched strings are replaced by the replacement specified,
613 if the global replacement indicator
614 .RB ` g '
615 appears after the command.
616 If the global indicator does not appear, only the first occurrence
617 of the matched string is replaced;
618 if the \fInumber\fR indicator is given,
619 the numbered occurrence is replaced.
620 It is an error for the substitution to fail on all addressed lines.
621 Any character other than space or new-line
622 may be used instead of `/' to delimit the regular expression
623 and the replacement.
624 `\fB.\fR' is left at the last line substituted.
625 .IP
626 An ampersand
627 .RB ` & '
628 appearing in the replacement
629 is replaced by the string matching the regular expression.
630 The special meaning of `&' in this context may be
631 suppressed by preceding it by
632 .RB ` \e '.
633 The characters `\|\fB\e\fIn\fR'
634 where
635 .I n
636 is a digit,
637 are replaced by the text matched by the
638 .IR n -th
639 regular subexpression
640 enclosed between `\e(' and `\e)'.
641 When
642 nested, parenthesized subexpressions
643 are present,
644 .I n
645 is determined by counting occurrences of `\e(' starting from the left.
646 .IP
647 A substitution string consisting of a single
648 .RB ` % '
649 causes the string given on the previous substitution to be re-used.
650 .IP
651 Lines may be split by substituting new-line characters into them.
652 The new-line in the
653 replacement string
654 must be escaped by preceding it by
655 .RB ` \e '.
656 .TP 5
657 \fR(\|\fI.\|\fB,\|\fI.\|\fR)\|\fBt\|\fIa\fR
658 This command acts just like the
659 .I m
660 command, except that a copy of the addressed lines is placed
661 after address
662 .I a
663 (which may be 0).
664 `\fB.\fR' is left on the last line of the copy.
665 .TP 5
666 .B u
667 The undo command restores
668 the contents of the buffer
669 before the last command was executed.
670 If the undo command is given twice,
671 the current state is restored.
672 .TP 5
673 \fR(\fI1\fB,\fI$\fR)\|\fBv/\fIregular expression\fB/\fIcommand list\fR
674 This command is the same as the global command
675 .I g
676 except that the command list is executed
677 .I g
678 with `\fB.\fR' initially set to every line
679 .I except
680 those
681 matching the regular expression.
682 .TP 5
683 \fR(\fI1\fB,\fI$\fR)\|\fBV/\fIregular expression\fB/\fR
684 This command is the same as the interactive global command
685 .I G
686 except that the commands are read
687 .I g
688 with `\fB.\fR' initially set to every line
689 .I except
690 those
691 matching the regular expression.
692 .TP 5
693 \fR(\fI1\fB,\fI$\fR)\|\fBw\ \fIfilename\fR
694 .br
695 The write command writes the addressed lines onto
696 the given file.
697 If the file does not exist,
698 it is created mode 666 (readable and writable by everyone)\|.
699 The file name is remembered if there was no
700 remembered file name already.
701 If no file name is given,
702 the remembered file name, if any, is used
703 (see
704 .I e
705 and
706 .I f
707 commands)\|.
708 `\fB.\fR' is unchanged.
709 If the command is successful, the number of characters written is
710 printed.
711 A `filename' starting with a `\fB!\fR'
712 causes the string following this character
713 to be executed as a shell command
714 with the addressed lines as standard input.
715 .TP
716 \fR(\fI1\fB,\fI$\fR)\fBW\ \fIfilename\fR
717 This command is the same as
718 .I w,
719 except that the addressed lines are appended to the file.
720 .TP 5
721 \fR(\fI$\fR)\|\fB=\fR
722 The line number of the addressed line is typed.
723 `\fB.\fR' is unchanged by this command.
724 .TP 5
725 \fB!\fR<shell command>
726 The remainder of the line after the `!' is sent
727 to
728 .IR sh (1)
729 to be interpreted as a command.
730 .RB ` . '
731 is unchanged.
732 If the command starts with a
733 .RB ` ! ',
734 the previous command is inserted.
735 A
736 .RB ` % '
737 causes the current file name to be inserted.
738 .TP 5
739 \fR(\|\fI.+1\fR)\|<newline>
740 An address alone on a line causes the addressed line to be printed.
741 A blank line alone is equivalent to `.+1p'; it is useful
742 for stepping through text.
743 .PP
744 The following commands are extensions:
745 .TP 5
746 \fR(\|\fI.\|\fR)\fB\|b\fR[\fIcount\fR]
747 Prints a screenful of lines,
748 starting at the addressed one,
749 and browses forward in the buffer by this amount.
750 With the optional
751 .I count
752 argument, the screen size for this and following
753 .I b
754 commands is set to the given number of lines.
755 .TP 5
756 .B help
757 Causes a summary of
758 .I ed
759 commands along with short descriptions
760 to be printed on the terminal.
761 .TP 5
762 .B N
763 Makes the
764 .I p
765 command behave like the
766 .I n
767 command and vice-versa.
768 If given a second time,
769 the original semantics are restored.
770 .TP 5
771 \fR(\|\fI.\|\fR)\fB\|o\fR[\fIcount\fR]
772 Prints a screenful of lines centered around the addressed one.
773 The current line is not changed.
774 With the optional
775 .I count
776 argument, the amount of lines printed above and below
777 for this and following
778 .I o
779 commands is set to the given number.
780 .TP 5
781 .B z
782 Performs the same actions as a
783 .I w
784 command followed by a
785 .I q
786 command.
787 .PP
788 If an interrupt signal is sent,
789 .I ed
790 prints a `?' and returns to its command level.
791 .PP
792 An input line that consists exactly of the two characters `\e.'
793 causes a period `.' to be inserted with the
794 .IR a ,
795 .IR c ,
796 and
797 .IR i
798 commands.
799 .PP
800 Some size limitations:
801 The maximum number of bytes in the buffer
802 corresponds to the address size;
803 on machines with 32-bit addressing,
804 it is 2\ G bytes,
805 with 64-bit addressing,
806 it is 9\ E bytes.
807 The limit on the number of lines depends on the amount of core:
808 each line takes 2 words.
809 .PP
810 If a line contains a NUL character,
811 regular expressions cannot match beyond this character.
812 A substitute command deletes a NUL
813 and all following characters on the line.
814 NUL characters in command input are discarded.
815 If an input file does not end with a newline,
816 .I ed
817 prints a message and appends one.
818 .PP
819 Omission of the `/' character
820 following the regular expression or the replacement string
821 to the global and substitute commands
822 causes the affected lines to be printed.
823 Thus the following commands have the same effect:
824 .RS
825 g/pattern g/pattern/p
826 .br
827 s/pattern/repl s/pattern/repl/p
828 .br
829 s/pattern/ s/pattern//p
830 .RE
831 .SH "ENVIRONMENT VARIABLES"
832 .TP
833 .BR LANG ", " LC_ALL
834 See
835 .IR locale (7).
836 .TP
837 .B LC_CTYPE
838 Determines the mapping of bytes to characters
839 and the set of printable characters for the
840 .I l
841 command.
842 .TP
843 .B TMPDIR
844 Determines the location of the temporary file
845 if it contains the name of an accessible directory.
846 .SH FILES
847 /var/tmp/e*
848 .br
849 /tmp/e*
850 .br
851 ed.hup: work is saved here if terminal hangs up
852 .SH "SEE ALSO"
853 B. W. Kernighan,
854 .I
855 A Tutorial Introduction to the ED Text Editor
856 .br
857 B. W. Kernighan,
858 .I Advanced editing on UNIX
859 .br
860 bfs(1),
861 grep(1),
862 sed(1),
863 sh(1)
864 .SH DIAGNOSTICS
865 `?name' for inaccessible file;
866 `?' for
867 errors in commands,
868 possibly followed by a verbose description
869 (see the description for the
870 .I h
871 and
872 .I H
873 commands above).
874 .PP
875 To protect against throwing away valuable work,
876 a
877 .I q
878 or
879 .I e
880 command is considered to be in error, unless a
881 .I w
882 has occurred since the last buffer change.
883 A second
884 .I q
885 or
886 .I e
887 will be obeyed regardless.
888 .SH NOTES
889 A
890 .I !\&
891 command cannot be subject to a
892 .I g
893 command.
894 .PP
895 The LC_COLLATE variable has currently no effect.
896 Ranges in bracket expressions are ordered
897 as byte values in single-byte locales
898 and as wide character values in multibyte locales.
899 .PP
900 For portable programs, restrict textual data
901 to the US-ASCII character set and
902 set the LC_CTYPE and LC_COLLATE variables to `C' or `POSIX'.