BSD 4_1_snap development
[unix-history] / usr / lib / learn / editor / L10.1b
#print
You can of course combine the various sorts
of line addresses we have been using.
Suppose the last line is line 6; then $ is
line 6, and $-1 is line 5. Thus $-1 is the
next to last line, and
1,$-1p
prints all but the last line of a file. Again,
I'll put you in the editor: print the last three lines
of the file. End with the usual w, q, and ready.
#create Ref
Gil Hodges
Yogi Berra
Roy McMillan
89
#create file
New York Mets Managers
Casey Stengel
Wes Westrum
Gil Hodges
Yogi Berra
Roy McMillan
#copyout
#pipe
ed file
#user
#unpipe
#uncopyout
tail -4 .ocopy >X1
#cmp X1 Ref
#fail
I hope you realized the addresses had to be
$-2,$p
to get the last three lines.
#cmp X1 Ref
#log
#next
11.1a 10
11.2a 5