.nr HY 0
.TL
Computer Systems \- Exercise 2
.AU
29 October - 4 November 1987
.PP
Em, like all Unix processes, can take its input (i.e. em commands) from a
file instead of from the keyboard.
If you had a file called
.B script
which contained em commands, you could automatically apply those edits
to a file called
.B poem
with the command line:
.DS I
.ie '\*(.T'lps' .ft C
.el .ft PO
% em poem < script
.ft
.DE
.PP
Create a file containing editor commands to perform the following edits
from last week's Editing Exercise:
.IP 1.
Find the first line containing the word `pleasant'.
.IP 2.
Change all occurrences of `pleasant' on this line to `nice'.
.IP 3.
Find the line containing the word `Carpenter'.
.IP 4.
Change `Carpenter' to `Carpenters'.
.IP 8.
On line 25, change all occurrences of `And' or `and' to `And yet' or `and yet' respectively.
.IP 14.
Remove all the leading spaces.
.LP
Don't forget to put a line saying
.B wq
at the end of the script.
.PP
Run em on a fresh copy of the poem in \fB/usr/work/tweedledum\fP,
with em's command input redirected from your script file.
.PP
The result should match the contents of the file \fB/usr/work/tweedledee\fP.
You can use the
.B diff
command to compare your edited file with it.
There is a manual page for \fBdiff\fP.
.PP
If you don't finish these sheets in the class,
you would be wise to do so in your own time.
