Deleted Added
full compact
ed.1 (49) ed.1 (1057)
1.TH ED 1 "21 May 1993"
2.SH NAME
3ed, red \- text editor
4.SH SYNOPSIS
5ed [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]
6.LP
7red [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]
8.SH DESCRIPTION

--- 120 unchanged lines hidden (view full) ---

129.IR sh (1).
130To read a file whose name begins with a bang, prefix the
131name with a backslash (\\).
132The default filename is set to
133.I file
134only if it is not prefixed with a bang.
135
136.SS LINE ADDRESSING
1.TH ED 1 "21 May 1993"
2.SH NAME
3ed, red \- text editor
4.SH SYNOPSIS
5ed [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]
6.LP
7red [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]
8.SH DESCRIPTION

--- 120 unchanged lines hidden (view full) ---

129.IR sh (1).
130To read a file whose name begins with a bang, prefix the
131name with a backslash (\\).
132The default filename is set to
133.I file
134only if it is not prefixed with a bang.
135
136.SS LINE ADDRESSING
137An address represents the number of line in the buffer.
137An address represents the number of a line in the buffer.
138.B ed
139maintains a
140.I current address
141which is
142typically supplied to commands as the default address when none is specified.
143When a file is first read, the current address is set to the last line
144of the file. In general, the current address is set to the last line
145affected by a command.

--- 14 unchanged lines hidden (view full) ---

160address
161.I 0
162(zero).
163This means "before the first line,"
164and is legal wherever it makes sense.
165
166An address range is two addresses separated either by a comma or
167semi-colon. The value of the first address in a range cannot exceed the
138.B ed
139maintains a
140.I current address
141which is
142typically supplied to commands as the default address when none is specified.
143When a file is first read, the current address is set to the last line
144of the file. In general, the current address is set to the last line
145affected by a command.

--- 14 unchanged lines hidden (view full) ---

160address
161.I 0
162(zero).
163This means "before the first line,"
164and is legal wherever it makes sense.
165
166An address range is two addresses separated either by a comma or
167semi-colon. The value of the first address in a range cannot exceed the
168value of the the second. If an
168value of the the second. If only one address is given in a range, then
169the second address is set to the given address. If an
169.IR n- tuple
170of addresses is given where
171.I n > 2,
170.IR n- tuple
171of addresses is given where
172.I n > 2,
172then the corresponding range is determined by the last two addresses
173in the
173then the corresponding range is determined by the last two addresses in
174the
174.IR n- tuple.
175.IR n- tuple.
175If only one address is expected, then the last
176address is used.
176If only one address is expected, then the last address is used.
177
178Each address in a comma-delimited range is interpreted relative to the
179current address. In a semi-colon-delimited range, the first address is
180used to set the current address, and the second address is interpreted
181relative to the first.
182
177
178Each address in a comma-delimited range is interpreted relative to the
179current address. In a semi-colon-delimited range, the first address is
180used to set the current address, and the second address is interpreted
181relative to the first.
182
183
183The following address symbols are recognized.
184
185.TP 8
184The following address symbols are recognized.
185
186.TP 8
186\fR.\fR
187\&.
187The current line (address) in the buffer.
188
189.TP 8
190$
191The last line in the buffer.
192
193.TP 8
194n

--- 311 unchanged lines hidden (view full) ---

506Any lines in the buffer are deleted before
507the new file is read.
508The current address is set to the last line read.
509
510.TP 8
511.RI e \ !command
512Edits the standard output of
513.IR `!command' ,
188The current line (address) in the buffer.
189
190.TP 8
191$
192The last line in the buffer.
193
194.TP 8
195n

--- 311 unchanged lines hidden (view full) ---

507Any lines in the buffer are deleted before
508the new file is read.
509The current address is set to the last line read.
510
511.TP 8
512.RI e \ !command
513Edits the standard output of
514.IR `!command' ,
514executed as described below.
515(see
516.RI ! command
517below).
515The default filename is unchanged.
516Any lines in the buffer are deleted before the output of
517.I command
518is read.
519The current address is set to the last line read.
520
521.TP 8
522.RI E \ file

--- 101 unchanged lines hidden (view full) ---

624(i.e., a single quote followed by
625.I lc
626) in subsequent commands. The mark is not cleared until the line is
627deleted or otherwise modified.
628
629.TP 8
630(.,.)l
631Prints the addressed lines unambiguously.
518The default filename is unchanged.
519Any lines in the buffer are deleted before the output of
520.I command
521is read.
522The current address is set to the last line read.
523
524.TP 8
525.RI E \ file

--- 101 unchanged lines hidden (view full) ---

627(i.e., a single quote followed by
628.I lc
629) in subsequent commands. The mark is not cleared until the line is
630deleted or otherwise modified.
631
632.TP 8
633(.,.)l
634Prints the addressed lines unambiguously.
635If a single line fills for than one screen (as might be the case
636when viewing a binary file, for instance), a `--More--'
637prompt is printed on the last line.
638.B ed
639waits until the RETURN key is pressed
640before displaying the next screen.
632The current address is set to the last line
633printed.
634
635.TP 8
636(.,.)m(.)
637Moves lines in the buffer. The addressed lines are moved to after the
638right-hand destination address, which may be the address
639.IR 0

--- 44 unchanged lines hidden (view full) ---

684The current address is set to the last line read.
685
686.TP 8
687.RI ($)r \ !command
688Reads
689to after the addressed line
690the standard output of
691.IR `!command' ,
641The current address is set to the last line
642printed.
643
644.TP 8
645(.,.)m(.)
646Moves lines in the buffer. The addressed lines are moved to after the
647right-hand destination address, which may be the address
648.IR 0

--- 44 unchanged lines hidden (view full) ---

693The current address is set to the last line read.
694
695.TP 8
696.RI ($)r \ !command
697Reads
698to after the addressed line
699the standard output of
700.IR `!command' ,
692executed as described below.
701(see the
702.RI ! command
703below).
693The default filename is unchanged.
694The current address is set to the last line read.
695
696.HP
697.RI (.,.)s /re/replacement/
698.PD 0
699.HP
700.RI (.,.)s /re/replacement/\fRg\fR
701.HP
702.RI (.,.)s /re/replacement/n
703.br
704Replaces text in the addressed lines
705matching a regular expression
706.I re
707with
708.IR replacement .
709By default, only the first match in each line is replaced.
704The default filename is unchanged.
705The current address is set to the last line read.
706
707.HP
708.RI (.,.)s /re/replacement/
709.PD 0
710.HP
711.RI (.,.)s /re/replacement/\fRg\fR
712.HP
713.RI (.,.)s /re/replacement/n
714.br
715Replaces text in the addressed lines
716matching a regular expression
717.I re
718with
719.IR replacement .
720By default, only the first match in each line is replaced.
710The
721If the
711.I `g'
722.I `g'
712(global) suffix causes every match to be replaced.
723(global) suffix is given, then every match to be replaced.
713The
714.I `n'
715suffix, where
716.I n
717is a postive number, causes only the
718.IR n th
719match to be replaced.
720It is an error if no substitutions are performed on any of the addressed
721lines.
722The current address is set the last line affected.
723
724.I re
725and
726.I replacement
724The
725.I `n'
726suffix, where
727.I n
728is a postive number, causes only the
729.IR n th
730match to be replaced.
731It is an error if no substitutions are performed on any of the addressed
732lines.
733The current address is set the last line affected.
734
735.I re
736and
737.I replacement
727may be delimited by any character other than space and newline.
738may be delimited by any character other than space and newline
739(see the
740.I `s'
741command below).
728If one or two of the last delimiters is omitted, then the last line
729affected is printed as though the print suffix
730.I `p'
731were specified.
732
733
734An unescaped `&' in
735.I replacement

--- 14 unchanged lines hidden (view full) ---

750.I replacement
751if they are escaped with a backslash (\\).
752
753.TP 8
754(.,.)s
755Repeats the last substitution.
756This form of the
757.I `s'
742If one or two of the last delimiters is omitted, then the last line
743affected is printed as though the print suffix
744.I `p'
745were specified.
746
747
748An unescaped `&' in
749.I replacement

--- 14 unchanged lines hidden (view full) ---

764.I replacement
765if they are escaped with a backslash (\\).
766
767.TP 8
768(.,.)s
769Repeats the last substitution.
770This form of the
771.I `s'
758command may be suffixed with
759any combination of the characters
772command accepts a count suffix
773.IR `n' ,
774or any combination of the characters
760.IR `r' ,
761.IR `g' ,
762and
763.IR `p' .
775.IR `r' ,
776.IR `g' ,
777and
778.IR `p' .
779If a count suffix
780.I `n'
781is given, then only the
782.IR n th
783match is replaced.
764The
765.I `r'
766suffix causes
767the regular expression of the last search to be used instead of the
768that of the last substitution.
769The
770.I `g'
771suffix toggles the global suffix of the last substitution.

--- 63 unchanged lines hidden (view full) ---

835and then executes a
836.I `q'
837command.
838
839.TP 8
840.RI (1,$)w \ !command
841Writes the addressed lines to the standard input of
842.IR `!command' ,
784The
785.I `r'
786suffix causes
787the regular expression of the last search to be used instead of the
788that of the last substitution.
789The
790.I `g'
791suffix toggles the global suffix of the last substitution.

--- 63 unchanged lines hidden (view full) ---

855and then executes a
856.I `q'
857command.
858
859.TP 8
860.RI (1,$)w \ !command
861Writes the addressed lines to the standard input of
862.IR `!command' ,
843executed as described below.
863(see the
864.RI ! command
865below).
844The default filename and current address are unchanged.
845
846.TP 8
847.RI (1,$)W \ file
848Appends the addressed lines to the end of
849.IR file .
850This is similar to the
851.I `w'

--- 34 unchanged lines hidden (view full) ---

886However, an unescaped
887.I `%'
888is replaced by the default filename.
889When the shell returns from execution, a `!'
890is printed to the standard output.
891The current line is unchanged.
892
893.TP 8
866The default filename and current address are unchanged.
867
868.TP 8
869.RI (1,$)W \ file
870Appends the addressed lines to the end of
871.IR file .
872This is similar to the
873.I `w'

--- 34 unchanged lines hidden (view full) ---

908However, an unescaped
909.I `%'
910is replaced by the default filename.
911When the shell returns from execution, a `!'
912is printed to the standard output.
913The current line is unchanged.
914
915.TP 8
894.RI (.,.)! command
895Replaces the addressed lines with the output of
896.I `!command'
897as described above.
898The current address is set to the last line read.
899
900.TP 8
901($)=
902Prints the line number of the addressed line.
903
904.TP 8
905(.+1)newline
906Prints the addressed line, and sets the current address to
907that line.
908

--- 76 unchanged lines hidden ---
916($)=
917Prints the line number of the addressed line.
918
919.TP 8
920(.+1)newline
921Prints the addressed line, and sets the current address to
922that line.
923

--- 76 unchanged lines hidden ---