10.0;edstr (edit_stream), revision 1.0, 88/04/21
edstr (edit_stream) -- Edit a stream.
usage: edstr [-n] { command | -e command | -f cmdfile ...} [pathname]
DESCRIPTION
edstr copies the named input files to standard output, performing editing
as directed by edstr commands in the command line or in the named command
file.
ARGUMENTS
If neither the -e nor the -f argument is specified, edstr assumes that
the first token on the command line without a hyphen is an edstr command
(see below) and that the remaining tokens (if any) are pathnames.
command (optional)
Specify a single edstr command (except a, c, i, or r).
edstr accepts the ed commands a, c, d, i, p, r, s, w, and
=. To use the a, c, i, or r commands, place them in a
command file as described below.
Default if omitted: use -e and/or -f
The following two arguments may be repeated and intermixed in any order.
edstr executes them in the order they appear on the command line.
-e command (optional)
Specify an edstr command (except a, c, i, or r). To use
the a, c, i, or r commands, place them in a command file
as described below. edstr can accommodate commands
totaling approximately 5000 characters (including text
arguments), and lines up to 120 characters long.
Default if omitted: use command or -f
-f cmdfile (optional)
Specify a file containing edstr commands, one per line.
Control is passed to this file for command processing.
See -e for edstr command restrictions.
Default if omitted: use command or -e
pathname (optional)
Specify input file to be edited. Multiple pathnames are
permitted.
Default if omitted: edit standard input
OPTIONS
-n Suppress writing of output except for p and w edstr
commands. By default, edstr writes each line of input to
standard output after editing. If the -n option is
specified, it must precede any arguments on the command
line.
COMMANDS
Addresses:
17 A decimal number
$ The last line of the file
/pat/ Search forward for line
containing pat
\pat\ Search backward for line
containing pat
line+n n lines forward from line
line-n n lines backward from line
Defaults:
()
(+1) Use the next line
(1,$) Use all lines
Commands:
() a Append text after line (text follows)
() c Change text (text follows)
() d Delete text
() i Insert text before line (text follows)
() p Print text (can be appended to other commands)
() r file Read file, appending after line
() s/pat/new/gp Substitute new for leftmost pat (g implies all
occurrences)
(1,$) w file Write file, leave current text unaltered (if
no file is specified, write to current
filename)
() =[p] Print line number, current line
Arguments:
$n Write to/read from the nth temporary buffer
EXAMPLES
$ edstr -e s/joe/mary/g -f rfil infile > outfile
where rfil is a file of one line:
20r add_stuff
This command first replaces all occurrences of joe with mary, then copies
material in the file add_stuff into infile following line 20. Results
are written to the file outfile.
SEE ALSO
More information is available. Type
help edstr commands
For a summary of edstr commands
help ed commands
For a complete description of the commands