2.11BSD/src/share/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
:"file" 6 lines, 89 characters
#create file
New York Mets Managers
Casey Stengel
Wes Westrum
Gil Hodges
Yogi Berra
Roy McMillan
#copyout
#pipe
ex +'set prompt noopt open' file
#user
#unpipe
#uncopyout
tail -4 .ocopy >X1
#cmp X1 Ref 4
#fail
I hope you realized the addresses had to be
$-2,$p
to get the last three lines.
#log
#next
11.1a 10
11.2a 5