8-bit characters are not ignored
[unix-history] / usr / src / contrib / ed / ed.1
CommitLineData
445c7738
KB
1.\" Copyright (c) 1992 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Rodney Ruddock of the University of Guelph.
6.\"
7.\" %sccs.include.redist.roff%
8.\"
cd766498 9.\" @(#)ed.1 5.3 (Berkeley) %G%
445c7738
KB
10.\"
11.TH ED 1 ""
12.SH NAME
13ed \- line oriented text editor
14.SH SYNOPSIS
15.B ed
16[
17.B \-p
18.I prompt-string
19] [
20.B \-s
21] [
22.B \-v
23] [
24.I filename
25]
26.SH DESCRIPTION
27.I Ed
e692f66f 28is a standard text editor.
445c7738
KB
29.PP
30\fIEd\fR is a powerful line oriented editor. Although ex(1)/vi(1) have gained
31popularity, \fIed\fR still maintains advantages over them. Most notable points
32are the
33.I W
34command (see below) (which is not part of ex(1)/vi(1)\|), the
e692f66f
KB
35smaller executable size (you can often be editing before the others finish
36loading), and the better response when editing from slow terminals or across
445c7738
KB
37low baud data lines. \fIEd\fR continues to be used by many system utilities.
38.SH OPTIONS
39.PP
40When a filename is present \fIed\fR starts by simulating an
41.I e
42command (see below)
43If no filename is present \fIed\fR
44starts with an empty buffer.
45The option
46.B \-p
47allows for the setting of a prompt string in
48.IR ed .
49The option
50.B \-s
51suppresses the printing
52of explanatory output
53(from the commands
54.IR e ,
55.IR E ,
56.IR r ,
57.IR w ,
58.I W
59and
60.IR wq ;
61see below) and should be used with a script.
62The
63.B \-v
64option will display a message of which mode (BSD or POSIX)
65.I ed
66as been set locally. This is useful for determining the described
67behavior below.
68.PP
69.I Ed
70performs all changes to a copy of the file which is contained in a \fBbuffer\fR.
71For the changes to have an effect one of the write commands (
72.IR w ,
73.IR W ,
74.IR wq ,
75or
76.IR Wq )
77must be issued.
78.PP
79The contents of the
80.B buffer
81can changed by issuing commands that are lead
82by zero, one, or two addresses. All commands are alphabetically listed below
83with their parameter structures if applicable; trailing structures not
84described with commands are regarded as erroneous. Commands that
85accept zero addresses regard the presence of any address as an error.
86.PP
87.I Ed
88works in two modes: command, and input. The two modes are exclusive of
89each other. While in command mode
90.I ed
91accepts commands that display, modify, or give information about the
92.BR buffer .
93While in input mode
94.I ed
95accepts lines of text to be added to the
96.BR buffer .
97.PP
98Addressing in \fIed\fR specifies one or more lines contained in the
99.BR buffer .
100For commands that expect at least one address, and none are given, default
101addresses will be used.
102Using addresses in
103.I ed
104involves understanding that during the execution of most
105.I ed
106commands that a
107.I "current line"
108(
109.BR current )
110exists.
111.B Current
112(as a rule of thumb) is the location in the
113.B buffer
114that the last command issued affected; some
115commands do not affect
116.BR current .
117Each command description (below) describes
118its affects on
119.B current
120as the affect will vary depending under which compile option (BSD or POSIX)
121.I ed
122was compiled under.
123Addresses can be divided into three cases: one
124address (\fBsingle address\fR), two addresses (an \fBaddress pair\fR),
125and special address forms.
126
127For the first two cases
128an address is formed with the use of:
129.TP
1301.
131A positive decimal integer (e.g. 123) indicating a line number in the buffer.
132Line number 1 is the first line in the buffer.
133.TP
1342.
135The `.' character indicating the current line (\fBcurrent\fR).
136.TP
1373.
138The `$' character which indicates the last line in the buffer.
139.TP
1404.
141A regular expression (RE) enclosed with `/'s as delimiters (i.e. /RE/).
142This causes a forward search to the first occurrence of the specified RE. The
143address will then become this line.
144The character sequence \e/ escapes the forwardslash from being a
145delimiter.
146The search will wrap from the bottom of
147the buffer to the top of the buffer if need be.
148.I Ed
149RE's are, outside of this document, now refered to as
150.IR "basic regular expressions" .
151Basic regular expressions (BRE's), traditionally described in \fIed(1)\fR are
152now fully described in regex(1). BRE's are, for the most part, the same as
153the old RE's - the name has changed and the expressions extended to meet
154POSIX 1003.2 specifications. (See the search command for more details.)
155.TP
1565.
157A RE enclosed with `?'s as delimiters (i.e. ?RE?).
158This will cause a backward search to the first occurrence of the
159specified BRE. The address will then become this line.
160The character sequence \e? escapes the questionmark from being a
161delimiter.
162The search will wrap
163from the top of the buffer to the
164bottom of the buffer if need be. (See the search command for more details.)
165.TP
1666.
167A line previously marked by the `k' command (see below). \fB`x\fR addresses
168the line marked by the single lower-case letter `\fBx\fR' (from the
169portable character set in the range a-z).
170.TP
1717.
172An address of the form 1-6 followed by a `+' followed by an integer number,
173.BR n ,
174specifies the line to be addressed is
175.B n
176lines after the address of the form
1771-6.
178If the address starts with a `+' then by default the addressed line is taken
179with respect to
180.B current
181(equivalent to `.'\|; form 2).
182If no integer number is given then 1 is added to the address.
183Hence, if
184more than one `+' is given in a sequence, with no integer number following,
1851 is added to the address for each `+'. Therefore, +++ is eqivalent to +3,
186but +++1 is equivalent to +1.
187.TP
1888.
189An address of the form 1-6 followed by a `\-' followed by an integer number,
190.BR n ,
191specifies the line to be addressed is
192.B n
193lines before the address of the form
1941-6.
195If the address starts with a `\-' then by default the
196addressed line is taken
197with respect to
198.B current
199(`.'\|; form 1).
200If no integer number is given then 1 is subtracted from the address.
201Hence, if
202more than one `\-' is given in a sequence, with no integer number following,
2031 is subtracted from the address for each `\-'. Therefore, \-\-\-
204is eqivalent to \-3,
205but \-\-\-1 is equivalent to \-1.
206For backward compatibility `^' is the equivalent to `\-'.
207.TP
2089.
209A `,' (comma) may be used to separate two addresses of the form 1-8 to
210create an \fBaddress pair\fR.
211The first address must occur no later in
212the buffer than the second address to be legal.
213.TP
21410.
215A `;' (semicolon) may be used to separate two addresses of the form 1-8 to
216create an \fBaddress pair\fR.
217With this form the second address is evaluated with respect to
218and after the first address has been evaluated. This is useful when
219addresses of the forms 2-8 are used.
220The first address must occur no later in
221the buffer than the second address to be legal.
222.TP
223NOTE:
224Addresses of the forms 7 and 8 cannot be followed by addresses
225of forms 2-6; it is an error.
226.PP
227The following are special address forms that cannot be combined
228with any of the address forms listed above.
229A `,' by itself represents the address pair `1,$'.
230Likewise `%' by itself represents the address pair `1,$'.
231A `;' by itself represents the address pair `.,$'.
232.PP
233The \fIed\fR commands listed below default to the addresses prefixing the
234commands. Commands without default addresses accept zero addresses.
235The parentheses with the default addresses are not part of
236the address; they are used to show that the addresses are
237default.
238.PP
239Generally only one command appears on a line at a time.
240However, many of the commands may be suffixed by `l', `n',
241or `p', in which case
242the current line is printed
243in the manner discussed below.
244These suffixes may be combined in any order.
245.TP 5
246.RB (\|.\|)\|a
247.br
248.ns
249.TP 5
250<text>
251.br
252.ns
253.TP 5
254.B .
255.br
256Append text after the addressed line. A `.' in the first column
257followed immediately by a <newline> places
258.I ed
259back in command mode - the `.' is not included in the text. Line 0
260is legal for this command; text will be placed at the top of the buffer.
261.B Current
262is the last line appended (or the addressed line if no text given).
263.TP 5
264.RB (\|.\|,\|.\|)\|c
265.br
266.ns
267.TP 5
268<text>
269.br
270.ns
271.TP 5
272.B .
273.br
274Change text on the addressed line(s). The addressed lines are deleted
275before
276.I
277ed
278is placed in input mode. A `.' in the first column
279followed immediately by a <newline> places
280.I ed
281back in command mode - the `.' is not included in the text.
282.B Current
283is the new last line appended (or if no text is given the line after
284the addressed line deleted).
285.TP 5
286.RB (\|.\|,\|.\|)\|d
287Delete the addressed line(s) from the buffer. Deleted lines may be
288recovered with the undo command (\fIu\fR; see below).
289.B
290Current
291is the line after the last addressed line deleted.
292.TP 5
293e [filename]
294Edit the new file `filename'. The
295.B buffer
296is cleared and the new file is placed in the
297.BR buffer .
298If the
299.B buffer
300has been modified since the last write command
301.I ed
302will issue a warning (`?'); a second issuing of
303the command will be obeyed regardless.
304The number of characters read is printed (unless -s is specified
305at startup). If `filename' is missing, the remembered
306name is used.
307If `filename' is lead by ! then it shall be interpreted as a shell
308command from which the output will be used as a non-remembered name.
309Undo will not restore the
310.B buffer
311to its state before the edit command.
312.B Current
313is the last line in the
314.B buffer
315(`$').
316.TP 5
317E [filename]
318.I E
319works the same as
320.I e
321except if the buffer has been modified no warning is issued.
322.TP 5
323f [filename]
324Print the
325.BR "remembered filename" .
326If `filename' is specified the
327.B "remembered filename"
328will be set to `filename'.
329If `filename' is lead by ! then it shall be interpreted as a shell
330command from which the output will be used as a non-remembered name.
331.B Current
332is unchanged.
333.TP 5
334(1,$)\|g/regular expression/command list
335The global command first marks all lines matching
336the regular expression.
337For each matching line, the
338command list is executed. At the start of each command list execution,
339\fBcurrent\fR is set to equal that line; \fBcurrent\fR may change
340as each command in the command list is executed for that line.
341The first command of the command list begins on the same line as
342the global command.
343Generally, in the command list one command occupies a line. Thus to
344have multiple commands in the command list it is necessary to escape the
345<newline> at the end of each line so that the global command does not
346interpret it as an indication that the command list entry has ended.
347The <newline> is escaped by proceeding it with a backslash (\e).
348Similarly with the commands that set \fIed\fR into input mode the <newlines>
e692f66f
KB
349of the entered text need to be escaped. If the `.' used to end input mode
350is the last line of the command list the <newline> following the `.' need
351not be escaped, or the `.' may be omitted entirely.
445c7738
KB
352Commands in the command list can affect any line in the buffer.
353For the behaviour of each \fIed\fR command within a command list refer to the
354information on the individual command.
355The commands
356.IR g ,
357.IR G ,
358.IR v ,
359.IR V ,
360and \fI!\fR
361are permitted in the command list, but should be used with caution.
362The command list defaults to
363.I p
364if left empty (i.e. g/RE/p).
365For the regular expression the delimiters can be any characters except
366for <space> and <newline>; delimiters within a regular expression can
367be escaped with a backslash preceeding it.
368.TP 5
369(1,$)\|G/regular expression/
370.br
371The interactive global command works similar to \fIg\fR. The first step
372is to mark every line which matches the given regular expression.
373For every line matched it will print this line, set \fBcurrent\fR
374to this line, and accept one command (not including \fIa\fR, \fIc\fR, \fIi\fR, \fIg\fR, \fIG\fR, \fIv\fR, and \fIV\fR)
375for execution.
376The command can affect any line in the buffer. `%' by itself executes
377the last non-null command.
378A return by itself will act as a null command. \fBCurrent\fR
379will be set to the last line affected by the last successful command
380input. If no match or an input command error occurs \fBcurrent\fR
381will be set to the last line searched by \fIG\fR. \fIG\fR can be prematurely
382ended by `ctrl-C' (SIGINT).
383
384.TP 5
385h
386.br
387The help command displays a message explaining the most recent command
388error (indicated by `?'). \fBCurrent\fR is unchanged.
389.TP 5
390H
391.br
392This toggles on or off the automatic display of messages explaining
393the most recent command error in place of `?'. \fBCurrent\fR is
394unchanged.
395.TP 5
396.RB (\|.\|)\|i
397.TP 5
398<text>
399.br
400.TP 5
401.B .
402.br
403The insert command places
404.I ed
405in input mode with the text being placed before the
406addressed line. Line 0 is invalid for this command.
407A `.' in the first column
408followed immediately by a return places
409.I ed
410back in command mode - the `.' is not included in the text.
411.B Current
412is the last line inserted. If no text is inserted then
413.B current
414is the addressed when
415.I ed
416is compiled for POSIX; compiled for BSD,
417.B current
418is the addressed line -1.
419.TP 5
420.RB (\|.\|,\|.+1)\|j
421The join command joins the addressed lines together to make one
422line. If no addresses are specified
423.B current
424and
425.BR current +1
426lines are joined.
427If one address only is given then
428no join is performed.
429.B Current
430becomes that line if
431.I ed
432has been compiled under the BSD option; if compiled under the POSIX
433option
434.B current
435is unchanged.
436.TP 5
437( \fB. \fR)\|k\fBx\fR
438The mark command marks the addressed line with label
439.BR x ,
440where
441.B x
442is a lowercase letter from the portable character set (a-z).
443The address form \fB`x\fR will refer to
444this line (address form 6 above).
445.B Current
446is unchanged.
447.TP 5
448.RB (\|.\|,\|.\|)\|l
449The list command
450prints the addressed lines in an unambiguous way:
451non-graphic characters are
452printed in three-digit octal preceded by a \e
453unless they are one of the following in which case they will be printed
454as indicated in the brackets:
455backslash (`\e\\'),
456horizontal tab (\et), form feed (\ef).
457return (\er), vertical tab (\ev), and backspace (\eb).
458Long lines will be broken base on the type of terminal currently in
459use.
460.B Current
461is set to the last line printed.
462The
463.I l
464command may be placed on the same line after any
465command except (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR).
466.TP 5
467.RB (\|.\|,\|.\|)\|m\fBa\fR
468The move command moves the addressed lines in the buffer
469to after the address
470.BR a .
471Line 0 is valid for this command.
472.B Current
473is the location in the
474.B buffer
475of the last line moved.
476.TP 5
477.RB (\|.\|,\|.\|)\|n
478The number command prints the addressed lines preceding the text with the line number.
479The
480.I n
481command
482may
483be placed on the same line after any command
484except (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR).
485.B Current
486is the last line printed.
487.TP 5
488.RB (\|.\|,\|.\|)\|p
489The print command prints the addressed lines.
490The
491.I p
492command
493may
494be placed on the same line after any command
495except (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR).
496.B Current
497is the last line printed.
498.TP
499.RB (\|.\|,\|.\|)\|P
500This command is a synonym for
501.I p
502if
503.I ed
504has been compiled under the BSD option. If
505.I ed
506has been compiled under the POSIX option then the prompt is toggled on or off.
507.B Current
508is unchanged when compiled under the POSIX option.
509The default prompt is "*" if not specified with the \-p option at startup.
510The prompt is initially off unless the \-p option is specified.
511.TP 5
512q
513The quit command causes
514.I ed
515to exit. If the
516.B buffer
517has been modified since the last write command
518.I ed
519will
520issue a warning once (`?'); a second issuing of the command will be obeyed
521regardless.
522.TP 5
523Q
524.I Q
525works the same as
526.I q
527except if the buffer has been modified no warning is issued.
528.TP 5
529($)\|r [filename]
530The read command reads in the file `filename' after the
531addressed line. If no `filename' is specified then the
532.B "remembered filename"
533is used. Address 0 is valid for this command.
534If read is successful then the number of characters
535read is printed (unless the -s option is specified).
536If `filename' is lead by ! then it shall be interpreted as a shell
537command from which the output will be used as a non-remembered name.
538.B Current
539is the last line read.
540.TP 5
541(\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/\fBreplacement\fR/\fBflags\fR
542.br
543The substitute command searches for the regular expression in the
544addressed lines.
545On each line in which a match is found,
546matched strings are replaced by the \fBreplacement\fR as specified
547by the \fBflags\fR (see below).
548If no \fBflags\fR appear, by default only the first occurrence
549of the matched string in each line is replaced.
550It is an error if no matches to the RE occur.
551.IP
552The delimiters may be any character except <space> or <newline>.
553The delimiter lead by a \e will escape it to be a literal
554in the RE or
555.BR replacement .
556.IP
557An ampersand, `&', appearing in the replacement
558will equal the string matching the RE.
559The `&'s special meaning is supressable by leading
560it with a `\e'.
561When `%' is the only replacement character in
562.B replacement
563the most recent
564replacement is used.
565The `%'s special meaning is supressable by leading
566it with a `\e'.
567.IP
568The characters `\fB\en\fR' (where \fBn\fR is a digit 1-9) is
569replaced by the text matching the RE subexpression
570.B n
571(known as backreferencing).
572.I S
573may be used to break lines by including a <newline> in
574.B replacement
575preceeded by a backslash (`\e') to escape it.
576.B Replacement
577can continue on the next line and can include another escaped <newline>.
578.IP
579The following extention should not be included in portable scripts.
580When spliting lines using \fIs\fR with the global commands (\fIg\fR,
581\fIG\fR, \fIv\fR, or \fIV\fR) the new-line in the replacement string
582must be escaped by preceding it with `\e\e\e' (three adjacent `\e'\|s \-
583the first \e escapes the second \e so that it is passed to \fIs\fR
584to escape the <newline>).
585.IP
586The \fBflags\fR may be any combination of:
587.RS
588.IP \fIcount\fR
589in each addressed line replace the \fIcount\fR\-th matching occurrence.
590.IP g
591in each addressed line replace all matching occurrences. When \fIcount\fR and
592g are specified together inclusively replace in each addressed line
593all matches from the \fIcount\fR\-th match to the end of line.
594.IP l
595write the line after replacement in the manner specified by the \fIl\fR
596command.
597.IP n
598write the line after replacement in the manner specified by the \fIn\fR
599command.
600.IP p
601write the line after replacement in the manner specified by the \fIp\fR
602command.
603.RE
604.IP
605The following special form
606should not be included in portable scripts.
607This form is maintained for backward compatibility and
608is extended to dovetail into the above forms of
609.BR s .
610.I S
611followed by
612.I no
613delimiters
614repeats the most recent substitute command
615on the addressed lines.
616.I S
617may be suffixed with the letters
618.BR r " (use the most recent RE rather than the last RE used with \fIs\fR),"
619.B p
620(complement the setting of the
621any print command (l, n, p)
622suffix from the previous substitution),
623.B g
624(complement the setting of the
625.I g
626suffix) or
627.B N
628(negate the previous \fIcount\fR flag).
629These modifying letters may be combined in any order
630(N.B. multiple use of the modifying letters may cause them
631to be interpreted as delimiters).
632.IP
633.B Current
634is set to the last line search (BSD) or where the last replacement
635occurred (POSIX).
636.TP 5
637.RB (\|.\|,\|.\|)\|t\|\fBa\fR
638The transcribe command copies the addressed lines in
639the
640.B buffer
641to after the address
642.BR a .
643Address 0 is valid for this command.
644.B Current
645is the last line transcribed.
646.TP 5
647.RB (\|.\|,\|.\|)\|u
648The undo command nullifies the most recent
649.B buffer
650modifying command.
651Buffer modifying commands undo works on are
652.IR a ,
653.IR c ,
654.IR d ,
655.IR g ,
656.IR G ,
657.IR i ,
658.IR j ,
659.IR m ,
660.IR r ,
661.IR s ,
662.IR t ,
663.IR u ,
664.IR v ,
665and
666.I V.
667Marks set by the \fIk\fR command will also be restored.
668All commands (including nested \fIg\fR, \fIG\fR, \fIv\fR, and
669\fIV\fR commands within the \fIg\fR or \fIv\fR)
670that undo works on are treated as a single buffer modification.
671\fBCurrent\fR is set to the line it addressed before the last
672buffer modification.
673.TP 5
674(1, $)\|v/regular expression/command list
675The global non-matching command performs as the
676.I g
677command does except that the command list is executed for every line
678that does not match the RE.
679.TP 5
680(1, $)\|V/regular expression/
681The interactive global non-matching command is the same as the
682.I G
683except that one command will be accepted as input
684with \fBcurrent\fR initially set to every line
685that does not match the RE.
686.TP 5
687(1, $)\|w [filename]
688.br
689The write command writes the addressed lines to the file `filename'.
690If no `filename' is specified then the
691.B "remembered filename"
692is used. If no addresses are specified the whole
693.B buffer
694is written.
695If the command is successful, the number of characters written is
696printed (unless the -s option is specified).
697If `filename' is lead by ! then it shall be interpreted as a shell
698command from which the output will be used as a non-remembered name.
699\fBCurrent\fR is unchanged.
700.TP
701(1, $)\|W [filename]
702.I W
703works as the
704.I w
705command does except the addressed contents of the
706.B buffer
707are appended to `filename' (or the
708.B "remember filename"
709if `filename' is not specified).
710\fBCurrent\fR is unchanged.
711.TP 5
712(1, $)\|wq [filename]
713.I wq
714works as the
715.I w
716command does with the addition that
717.I ed
718exits immediately after the write is complete.
719\fBCurrent\fR is unchanged.
720.TP 5
721(1,$)\|Wq [filename]
722.I Wq
723works as the
724.I W
725command does with the addition that
726.I ed
727exits immediately after the write is complete.
728\fBCurrent\fR is unchanged.
729.TP 5
730.RB (\|.\|+1)\|z\ \ \ \ or,
731.br
732.TP 5
733.RB (\|.\|+1)\|z\fBn\fR
734Scroll through the
735.BR buffer .
736Starting from the addressed line (or
737.BR current +1)
738print the next 22 (by default or
739.BR n )
740lines. The
741.B n
742is a sticky value; it becomes the default number of lines printed
743for successive scrolls.
744.B Current
745is the last line printed.
746.TP 5
747($)\|=
748Print the number of lines in the
749.BR buffer .
750If an address is provided (in the forms 1-8 above) then the line number
751for that line will be printed.
752\fBCurrent\fR is unchanged.
753.TP 5
754!<shell command>
755The command after the
756.I !
757is executed by \fIsh(1)\fR and the results are printed. A `!' is
758printed in the first column when execution has completed (unless the -s
759option has been specified).
760A `!' after \fI!\fR repeats the last shell command. An unescaped `%'
761represents the remembered pathname.
762\fBCurrent\fR is unchanged.
763.TP 5
764/regular expression/\|\|\|\|\|or,
765.br
766.TP 5
767?regular expression?
768.br
769The search command searches forward, `/', (or backward, `?') through the
770.B buffer
771attempting to find
772a line that matches the RE. The search will wrap to the top (or bottom)
773of the
774.B buffer
775if necessary. Search returns the line number that the match occurs on -
776combined with the null command (see below) this causes the line to be printed.
777.B Current
778is the matching line.
779.TP 5
780.RB (\|.+1,\|.+1)\|<newline>
781.br
782The null command is equivalent to asking for the line
783.BR current +1
784to be printed according to the
785.I p
786command. This is a useful command to quickly print the next couple of
787lines. If more than a couple of lines are needed the
788.I z
789command (see above) is much better to use.
790\fBCurrent\fR is the last line printed.
791
792.SH OTHER
793.PP
794If an interrupt signal (SIGINT)\| is sent,
795.I ed
796prints `?'
797and returns to command mode.
798.PP
799BSD command pairs (pp, ll, etc.) are permitted. Additionally any single
800print command may follow any of the non-I/O commands (I/O commands:
801e, E, f, r, w, W, wq, and !). This will cause the current line to be
802printed in the specified manner after the command has completed.
803.PP
804Previous limitations on the number of characters per line and per command
805list have been lifted; there is now no maximum.
806File name and path length is restricted to the maximum length that
807the current file system supports.
808The
809.I undo
810command now restores marks to affected lines.
811The temporary buffer method will vary dependent on the method selected at
812compile. Two methods work with a temporary file (stdio and db), while the
813third uses memory.
814The limit on the number of lines depends on the amount of memory.
815.SH FILES
816/tmp/_bsd44_ed*
817.br
818.XP
819ed.hup: the buffer is written to this file in the current
820directory if possible and in the HOME directory is not
821(if the signal SIGHUP (hangup) is received).
822.SH "SEE ALSO"
823B. W. Kernighan,
824.I
825A Tutorial Introduction to the ED Text Editor
826.br
827B. W. Kernighan,
828.I
829Advanced editing on UNIX
830.br
831regex(7), sed(1), learn(1), ex(1), POSIX 1003.2 (4.20)
832.SH "AUTHOR"
833Rodney Ruddock
834.SH DIAGNOSTICS
835`?name' for a file that is either inaccessible, does not exist, or is
836a directory. `?'
837for all other errors unless the help messages have been toggled on (with
838the H command) in which case a descriptive message will be printed.
839.PP
cd766498
KB
840All NULL characters are ignored during input from the user or files.
841EOF is treated as a newline so that characters after the last <newline>
842are included into the \fBbuffer\fR.
445c7738
KB
843.PP
844.I Ed
845returns 0 on successful completion. A value >0 is returned
846when an \fIed\fR command failed.
847.SH NOTES
848.PP
849Regular expressions are now described on regex(7).
850.I Ed
851follows basic regular expressions (BRE's) as described on regex(7).
852BRE's, for the most part, are the same as previous
853.I ed
854RE's. The changes to the RE's are extension for internationalization
855under POSIX 1003.2. Old scripts with RE's should work without
856modification.
857.PP
858The special form of substitute has been maintained for backward
859compatability and should not be used in scripts if they are to
860portable.
861.PP
862Help messages may appear ambiguous to beginners - particularly when BRE's
863form part of the command.
864.PP
865For backward compatability, when more addresses are provided
866than required by a command the one or two addresses closest to the
867command are used (depending on how may addresses the command accepts).
868Portable scripts should not rely on this feature.
869.PP
870For backward compatibility the option `-' is
871equivalent to the `-s' option at the startup of
872.IR ed .