--- diff-t11.l+++ diff-t11.r@@ -1,1003 +1,908 @@-.\" $OpenBSD: t11.1,v 1.2 2007/11/27 16:22:12 martynas Exp $-.\" $NetBSD: ed.1,v 1.13 1995/03/21 09:04:38 cgd Exp $+.\" $OpenBSD: t11.2,v 1.1 2003/07/21 20:16:21 otto Exp $ .\"-.TH ED 1 "21 May 1993"-.SH NAME-.\" ed, red \- text editor-ed \- text editor-.SH SYNOPSIS-ed [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]-.\" .LP-.\" red [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]-.SH DESCRIPTION-.B ed+.Dd May 2, 1993+.Dt ED 1+.Os+.Sh NAME+.Nm ed+.Nd text editor+.Sh SYNOPSIS+.Nm ed+.Op Fl+.Op Fl sx+.Op Fl p Ar string+.Op Ar file+.Sh DESCRIPTION+.Nm is a line-oriented text editor.-It is used to create, display, modify and otherwise manipulate text-files.-.\" .B red-.\" is a restricted-.\" .BR ed :-.\" it can only edit files in the current-.\" directory and cannot execute shell commands.-+It is used to create, display, modify, and otherwise manipulate text files. If invoked with a-.I file+.Ar file argument, then a copy of-.I file+.Ar file is read into the editor's buffer. Changes are made to this copy and not directly to-.I file+.Ar file itself. Upon quitting-.BR ed ,-any changes not explicitly saved with a-.I `w'+.Nm ed ,+any changes not explicitly saved with a+.Em w command are lost.-+.Pp Editing is done in two distinct modes:-.I command+.Em command and-.IR input .+.Em input . When first invoked,-.B ed+.Nm is in command mode.-In this mode commands are read from the standard input and+In this mode, commands are read from the standard input and executed to manipulate the contents of the editor buffer.+.Pp A typical command might look like:-.sp-.RS-,s/\fIold\fR/\fInew\fR/g-.RE-.sp+.Bd -literal -offset indent+,s/old/new/g+.Ed+.Pp which replaces all occurrences of the string-.I old+.Pa old with-.IR new .-+.Pa new .+.Pp When an input command, such as-.I `a'+.Em a (append),-.I `i'-(insert) or-.I `c'-(change), is given,-.B ed-enters input mode. This is the primary means-of adding text to a file.+.Em i+(insert),+or+.Em c+(change) is given,+.Nm+enters input mode.+This is the primary means of adding text to a file. In this mode, no commands are available;-instead, the standard input is written-directly to the editor buffer. Lines consist of text up to and-including a-.IR newline-character.-Input mode is terminated by-entering a single period (\fI.\fR) on a line.-+instead, the standard input is written directory to the editor buffer.+Lines consist of text up to and including a newline character.+Input mode is terminated by entering a single period+.Pq Ql \&.+on a line.+.Pp All-.B ed+.Nm commands operate on whole lines or ranges of lines; e.g., the-.I `d'+.Em d command deletes lines; the-.I `m'+.Em m command moves lines, and so on. It is possible to modify only a portion of a line by means of replacement,-as in the example above. However even here, the-.I `s'+as in the example above.+However, even here, the+.Em s command is applied to whole lines at a time.-+.Pp In general,-.B ed+.Nm commands consist of zero or more line addresses, followed by a single character command and possibly additional parameters; i.e., commands have the structure:-.sp-.RS-.I [address [,address]]command[parameters]-.RE-.sp+.Bd -literal -offset indent+[address [,address]]command[parameters]+.Ed+.Pp The address(es) indicate the line or range of lines to be affected by the-command. If fewer addresses are given than the command accepts, then+command.+If fewer addresses are given than the command accepts, then default addresses are supplied.--.SS OPTIONS-.TP 8--s-Suppresses diagnostics. This should be used if-.BR ed 's+.Pp+The options are as follows:+.Bl -tag -width Ds+.It Fl+Same as the+.Fl s+option (deprecated).+.It Fl s+Suppress diagnostics.+This should be used if+.Nm standard input is from a script.--.TP 8--x-Prompts for an encryption key to be used in subsequent reads and writes+.Fl s+flag.+.It Fl x+Prompt for an encryption key to be used in subsequent reads and writes (see the-.I `x'+.Em x command).--.TP 8-.RI \-p \ string-Specifies a command prompt. This may be toggled on and off with the-.I `P'+.It Fl p Ar string+Specifies a command prompt.+This may be toggled on and off with the+.Em P command.--.TP 8-.I file-Specifies the name of a file to read. If-.I file+.It Ar file+Specifies the name of a file to read.+If+.Ar file is prefixed with a-bang (!), then it is interpreted as a shell command. In this case,-what is read is-the standard output of-.I file+bang+.Pq Ql \&! ,+then it is interpreted as a shell command.+In this case, what is read is the standard output of+.Ar file executed via-.IR sh (1).+.Xr sh 1 . To read a file whose name begins with a bang, prefix the-name with a backslash (\\).+name with a backslash+.Pq Ql \e . The default filename is set to-.I file+.Ar file only if it is not prefixed with a bang.--.SS LINE ADDRESSING+.El+.Ss LINE ADDRESSING An address represents the number of a line in the buffer.-.B ed+.Nm maintains a-.I current address-which is-typically supplied to commands as the default address when none is specified.-When a file is first read, the current address is set to the last line-of the file. In general, the current address is set to the last line-affected by a command.-+.Em current address+which is typically supplied to commands as the default address+when none is specified.+When a file is first read, the current address is set to the last line+of the file.+In general, the current address is set to the last line affected by a command.+.Pp A line address is constructed from one of the bases in the list below, optionally followed-by a numeric offset. The offset may include any combination-of digits, operators (i.e.,-.IR + ,-.I -+by a numeric offset.+The offset may include any combination of digits, operators (i.e.,+.Em + ,+.Em - , and-.IR ^ )+.Em ^ ) , and whitespace. Addresses are read from left to right, and their values are computed relative to the current address.-+.Pp One exception to the rule that addresses represent line numbers is the address-.I 0+.Em 0 (zero).-This means "before the first line,"+This means+.Dq before the first line , and is legal wherever it makes sense.--An address range is two addresses separated either by a comma or-semi-colon. The value of the first address in a range cannot exceed the-value of the second. If only one address is given in a range, then-the second address is set to the given address. If an-.IR n- tuple+.Pp+An address range is two addresses separated either by a comma or semi-colon.+The value of the first address in a range cannot exceed the+value of the second.+If only one address is given in a range,+then the second address is set to the given address.+If an+.Em n Ns No -tuple of addresses is given where-.I n > 2,-then the corresponding range is determined by the last two addresses in-the-.IR n- tuple.+.Em n > 2 ,+then the corresponding range is determined by the last two addresses in the+.Em n Ns No -tuple. If only one address is expected, then the last address is used.-+.Pp Each address in a comma-delimited range is interpreted relative to the-current address. In a semi-colon-delimited range, the first address is+current address.+In a semi-colon-delimited range, the first address is used to set the current address, and the second address is interpreted relative to the first.---The following address symbols are recognized.--.TP 8-\&.+.Pp+The following address symbols are recognized:+.Bl -tag -width Ds+.It Em \&. The current line (address) in the buffer.--.TP 8-$+.It Em $ The last line in the buffer.--.TP 8-n+.It Em n The-.IR n th,-line in the buffer-where-.I n+.Em n Ns No th+line in the buffer where+.Em n is a number in the range-.I [0,$].--.TP 8-- or ^+.Em [0,$] .+.It Em - No or Em ^ The previous line. This is equivalent to-.I -1+.Em -1 and may be repeated with cumulative effect.--.TP 8--\fIn\fR or ^\fIn\fR+.It Em -n No or Em ^n The-.IR n th+.Em n Ns No th previous line, where-.I n+.Em n is a non-negative number.--.TP 8-+-The-next line.+.It Em ++The next line. This is equivalent to-.I +1+.Em +1 and may be repeated with cumulative effect.--.TP 8-+\fIn\fR or whitespace\fIn\fR+.It Em +n The-.IR n th+.Em n Ns No th next line, where-.I n+.Em n is a non-negative number.-.I whitespace-followed by a number-.I n-is interpreted as-.IR +n .--.TP 8-, \fRor\fB %-The first through last lines in the buffer. This is equivalent to-the address range-.I 1,$.--.TP 8-;-The-current through last lines in the buffer. This is equivalent to-the address range-.I .,$.--.TP 8-.RI / re/-The-next line containing the regular expression-.IR re .+.It Em \&, No or Em %+The first through last lines in the buffer.+This is equivalent to the address range+.Em 1,$ .+.It Em \&;+The current through last lines in the buffer.+This is equivalent to the address range+.Em .,$ .+.It Em / Ns No re Ns Em /+The next line containing the regular expression+.Em re . The search wraps to the beginning of the buffer and continues down to the current line, if necessary.-// repeats the last search.--.TP 8-.RI ? re?-The-previous line containing the regular expression-.IR re .+.Em //+repeats the last search.+.It Em ? Ns No re Ns Em ?+The previous line containing the regular expression+.Em re . The search wraps to the end of the buffer and continues up to the current line, if necessary.-?? repeats the last search.--.TP 8-.RI \' lc-The-line previously marked by a-.I `k'+.Em ??+repeats the last search.+.It Em \&\' Ns No lc+The line previously marked by a+.Em k (mark) command, where-.I lc+.Em lc is a lower case letter.--.SS REGULAR EXPRESSIONS+.El+.Ss REGULAR EXPRESSIONS Regular expressions are patterns used in selecting text. For example, the-.B ed+.Nm command-.sp-.RS-g/\fIstring\fR/-.RE-.sp+.Bd -literal -offset indent+g/string/+.Ed+.Pp prints all lines containing-.IR string .-Regular expressions are also-used by the-.I `s'+.Em string .+Regular expressions are also used by the+.Em s command for selecting old text to be replaced with new.-+.Pp In addition to a specifying string literals, regular expressions can-represent-classes of strings. Strings thus represented are said to be matched-by the corresponding regular expression.-If it is possible for a regular expression-to match several strings in a line, then the left-most longest match is-the one selected.-+represent classes of strings.+Strings thus represented are said to be matched by the+corresponding regular expression.+If it is possible for a regular expression to match several strings in+a line, then the leftmost longest match is the one selected.Lines 1–500 of 1612. Load more
--- diff-t11.l +++ diff-t11.r @@ -1,1003 +1,908 @@ -.\" $OpenBSD: t11.1,v 1.2 2007/11/27 16:22:12 martynas Exp $ -.\" $NetBSD: ed.1,v 1.13 1995/03/21 09:04:38 cgd Exp $ +.\" $OpenBSD: t11.2,v 1.1 2003/07/21 20:16:21 otto Exp $ .\" -.TH ED 1 "21 May 1993" -.SH NAME -.\" ed, red \- text editor -ed \- text editor -.SH SYNOPSIS -ed [-] [-sx] [-p \fIstring\fR] [\fIfile\fR] -.\" .LP -.\" red [-] [-sx] [-p \fIstring\fR] [\fIfile\fR] -.SH DESCRIPTION -.B ed +.Dd May 2, 1993 +.Dt ED 1 +.Os +.Sh NAME +.Nm ed +.Nd text editor +.Sh SYNOPSIS +.Nm ed +.Op Fl +.Op Fl sx +.Op Fl p Ar string +.Op Ar file +.Sh DESCRIPTION +.Nm is a line-oriented text editor. -It is used to create, display, modify and otherwise manipulate text -files. -.\" .B red -.\" is a restricted -.\" .BR ed : -.\" it can only edit files in the current -.\" directory and cannot execute shell commands. - +It is used to create, display, modify, and otherwise manipulate text files. If invoked with a -.I file +.Ar file argument, then a copy of -.I file +.Ar file is read into the editor's buffer. Changes are made to this copy and not directly to -.I file +.Ar file itself. Upon quitting -.BR ed , -any changes not explicitly saved with a -.I `w' +.Nm ed , +any changes not explicitly saved with a +.Em w command are lost. - +.Pp Editing is done in two distinct modes: -.I command +.Em command and -.IR input . +.Em input . When first invoked, -.B ed +.Nm is in command mode. -In this mode commands are read from the standard input and +In this mode, commands are read from the standard input and executed to manipulate the contents of the editor buffer. +.Pp A typical command might look like: -.sp -.RS -,s/\fIold\fR/\fInew\fR/g -.RE -.sp +.Bd -literal -offset indent +,s/old/new/g +.Ed +.Pp which replaces all occurrences of the string -.I old +.Pa old with -.IR new . - +.Pa new . +.Pp When an input command, such as -.I `a' +.Em a (append), -.I `i' -(insert) or -.I `c' -(change), is given, -.B ed -enters input mode. This is the primary means -of adding text to a file. +.Em i +(insert), +or +.Em c +(change) is given, +.Nm +enters input mode. +This is the primary means of adding text to a file. In this mode, no commands are available; -instead, the standard input is written -directly to the editor buffer. Lines consist of text up to and -including a -.IR newline -character. -Input mode is terminated by -entering a single period (\fI.\fR) on a line. - +instead, the standard input is written directory to the editor buffer. +Lines consist of text up to and including a newline character. +Input mode is terminated by entering a single period +.Pq Ql \&. +on a line. +.Pp All -.B ed +.Nm commands operate on whole lines or ranges of lines; e.g., the -.I `d' +.Em d command deletes lines; the -.I `m' +.Em m command moves lines, and so on. It is possible to modify only a portion of a line by means of replacement, -as in the example above. However even here, the -.I `s' +as in the example above. +However, even here, the +.Em s command is applied to whole lines at a time. - +.Pp In general, -.B ed +.Nm commands consist of zero or more line addresses, followed by a single character command and possibly additional parameters; i.e., commands have the structure: -.sp -.RS -.I [address [,address]]command[parameters] -.RE -.sp +.Bd -literal -offset indent +[address [,address]]command[parameters] +.Ed +.Pp The address(es) indicate the line or range of lines to be affected by the -command. If fewer addresses are given than the command accepts, then +command. +If fewer addresses are given than the command accepts, then default addresses are supplied. - -.SS OPTIONS -.TP 8 --s -Suppresses diagnostics. This should be used if -.BR ed 's +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl +Same as the +.Fl s +option (deprecated). +.It Fl s +Suppress diagnostics. +This should be used if +.Nm standard input is from a script. - -.TP 8 --x -Prompts for an encryption key to be used in subsequent reads and writes +.Fl s +flag. +.It Fl x +Prompt for an encryption key to be used in subsequent reads and writes (see the -.I `x' +.Em x command). - -.TP 8 -.RI \-p \ string -Specifies a command prompt. This may be toggled on and off with the -.I `P' +.It Fl p Ar string +Specifies a command prompt. +This may be toggled on and off with the +.Em P command. - -.TP 8 -.I file -Specifies the name of a file to read. If -.I file +.It Ar file +Specifies the name of a file to read. +If +.Ar file is prefixed with a -bang (!), then it is interpreted as a shell command. In this case, -what is read is -the standard output of -.I file +bang +.Pq Ql \&! , +then it is interpreted as a shell command. +In this case, what is read is the standard output of +.Ar file executed via -.IR sh (1). +.Xr sh 1 . To read a file whose name begins with a bang, prefix the -name with a backslash (\\). +name with a backslash +.Pq Ql \e . The default filename is set to -.I file +.Ar file only if it is not prefixed with a bang. - -.SS LINE ADDRESSING +.El +.Ss LINE ADDRESSING An address represents the number of a line in the buffer. -.B ed +.Nm maintains a -.I current address -which is -typically supplied to commands as the default address when none is specified. -When a file is first read, the current address is set to the last line -of the file. In general, the current address is set to the last line -affected by a command. - +.Em current address +which is typically supplied to commands as the default address +when none is specified. +When a file is first read, the current address is set to the last line +of the file. +In general, the current address is set to the last line affected by a command. +.Pp A line address is constructed from one of the bases in the list below, optionally followed -by a numeric offset. The offset may include any combination -of digits, operators (i.e., -.IR + , -.I - +by a numeric offset. +The offset may include any combination of digits, operators (i.e., +.Em + , +.Em - , and -.IR ^ ) +.Em ^ ) , and whitespace. Addresses are read from left to right, and their values are computed relative to the current address. - +.Pp One exception to the rule that addresses represent line numbers is the address -.I 0 +.Em 0 (zero). -This means "before the first line," +This means +.Dq before the first line , and is legal wherever it makes sense. - -An address range is two addresses separated either by a comma or -semi-colon. The value of the first address in a range cannot exceed the -value of the second. If only one address is given in a range, then -the second address is set to the given address. If an -.IR n- tuple +.Pp +An address range is two addresses separated either by a comma or semi-colon. +The value of the first address in a range cannot exceed the +value of the second. +If only one address is given in a range, +then the second address is set to the given address. +If an +.Em n Ns No -tuple of addresses is given where -.I n > 2, -then the corresponding range is determined by the last two addresses in -the -.IR n- tuple. +.Em n > 2 , +then the corresponding range is determined by the last two addresses in the +.Em n Ns No -tuple. If only one address is expected, then the last address is used. - +.Pp Each address in a comma-delimited range is interpreted relative to the -current address. In a semi-colon-delimited range, the first address is +current address. +In a semi-colon-delimited range, the first address is used to set the current address, and the second address is interpreted relative to the first. - - -The following address symbols are recognized. - -.TP 8 -\&. +.Pp +The following address symbols are recognized: +.Bl -tag -width Ds +.It Em \&. The current line (address) in the buffer. - -.TP 8 -$ +.It Em $ The last line in the buffer. - -.TP 8 -n +.It Em n The -.IR n th, -line in the buffer -where -.I n +.Em n Ns No th +line in the buffer where +.Em n is a number in the range -.I [0,$]. - -.TP 8 -- or ^ +.Em [0,$] . +.It Em - No or Em ^ The previous line. This is equivalent to -.I -1 +.Em -1 and may be repeated with cumulative effect. - -.TP 8 --\fIn\fR or ^\fIn\fR +.It Em -n No or Em ^n The -.IR n th +.Em n Ns No th previous line, where -.I n +.Em n is a non-negative number. - -.TP 8 -+ -The -next line. +.It Em + +The next line. This is equivalent to -.I +1 +.Em +1 and may be repeated with cumulative effect. - -.TP 8 -+\fIn\fR or whitespace\fIn\fR +.It Em +n The -.IR n th +.Em n Ns No th next line, where -.I n +.Em n is a non-negative number. -.I whitespace -followed by a number -.I n -is interpreted as -.IR +n . - -.TP 8 -, \fRor\fB % -The first through last lines in the buffer. This is equivalent to -the address range -.I 1,$. - -.TP 8 -; -The -current through last lines in the buffer. This is equivalent to -the address range -.I .,$. - -.TP 8 -.RI / re/ -The -next line containing the regular expression -.IR re . +.It Em \&, No or Em % +The first through last lines in the buffer. +This is equivalent to the address range +.Em 1,$ . +.It Em \&; +The current through last lines in the buffer. +This is equivalent to the address range +.Em .,$ . +.It Em / Ns No re Ns Em / +The next line containing the regular expression +.Em re . The search wraps to the beginning of the buffer and continues down to the current line, if necessary. -// repeats the last search. - -.TP 8 -.RI ? re? -The -previous line containing the regular expression -.IR re . +.Em // +repeats the last search. +.It Em ? Ns No re Ns Em ? +The previous line containing the regular expression +.Em re . The search wraps to the end of the buffer and continues up to the current line, if necessary. -?? repeats the last search. - -.TP 8 -.RI \' lc -The -line previously marked by a -.I `k' +.Em ?? +repeats the last search. +.It Em \&\' Ns No lc +The line previously marked by a +.Em k (mark) command, where -.I lc +.Em lc is a lower case letter. - -.SS REGULAR EXPRESSIONS +.El +.Ss REGULAR EXPRESSIONS Regular expressions are patterns used in selecting text. For example, the -.B ed +.Nm command -.sp -.RS -g/\fIstring\fR/ -.RE -.sp +.Bd -literal -offset indent +g/string/ +.Ed +.Pp prints all lines containing -.IR string . -Regular expressions are also -used by the -.I `s' +.Em string . +Regular expressions are also used by the +.Em s command for selecting old text to be replaced with new. - +.Pp In addition to a specifying string literals, regular expressions can -represent -classes of strings. Strings thus represented are said to be matched -by the corresponding regular expression. -If it is possible for a regular expression -to match several strings in a line, then the left-most longest match is -the one selected. - +represent classes of strings. +Strings thus represented are said to be matched by the +corresponding regular expression. +If it is possible for a regular expression to match several strings in +a line, then the leftmost longest match is the one selected.