summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib
diff options
context:
space:
mode:
authorIan Darwin <ian@cvs.openbsd.org>1998-09-28 16:01:46 +0000
committerIan Darwin <ian@cvs.openbsd.org>1998-09-28 16:01:46 +0000
commit8d70bdbdf6fd88bf88b9a384cfaafb6668c804ec (patch)
tree034fd6a68d5b6928d6fe4e51de71c9868bb460b1 /usr.bin/learn/lib
parente9be7faad5fbf61edcad3700142615e315e407bc (diff)
import BTL learn(1) lessons/editor
Diffstat (limited to 'usr.bin/learn/lib')
-rw-r--r--usr.bin/learn/lib/editor/L02
-rw-r--r--usr.bin/learn/lib/editor/L1.1a21
-rw-r--r--usr.bin/learn/lib/editor/L10.1a32
-rw-r--r--usr.bin/learn/lib/editor/L10.1b39
-rw-r--r--usr.bin/learn/lib/editor/L10.2a39
-rw-r--r--usr.bin/learn/lib/editor/L10.2b30
-rw-r--r--usr.bin/learn/lib/editor/L10.2c18
-rw-r--r--usr.bin/learn/lib/editor/L10.3a27
-rw-r--r--usr.bin/learn/lib/editor/L10.3b36
-rw-r--r--usr.bin/learn/lib/editor/L10.3c19
-rw-r--r--usr.bin/learn/lib/editor/L10.3d13
-rw-r--r--usr.bin/learn/lib/editor/L10.3e14
-rw-r--r--usr.bin/learn/lib/editor/L10.3f32
-rw-r--r--usr.bin/learn/lib/editor/L11.1a44
-rw-r--r--usr.bin/learn/lib/editor/L11.2a48
-rw-r--r--usr.bin/learn/lib/editor/L11.2b28
-rw-r--r--usr.bin/learn/lib/editor/L11.2c30
-rw-r--r--usr.bin/learn/lib/editor/L12.1a33
-rw-r--r--usr.bin/learn/lib/editor/L12.1b27
-rw-r--r--usr.bin/learn/lib/editor/L12.2a39
-rw-r--r--usr.bin/learn/lib/editor/L12.2b17
-rw-r--r--usr.bin/learn/lib/editor/L12.2c22
-rw-r--r--usr.bin/learn/lib/editor/L13.1a32
-rw-r--r--usr.bin/learn/lib/editor/L13.2a34
-rw-r--r--usr.bin/learn/lib/editor/L13.2b23
-rw-r--r--usr.bin/learn/lib/editor/L14.1a30
-rw-r--r--usr.bin/learn/lib/editor/L14.2a26
-rw-r--r--usr.bin/learn/lib/editor/L14.2b23
-rw-r--r--usr.bin/learn/lib/editor/L15.1a35
-rw-r--r--usr.bin/learn/lib/editor/L15.1b18
-rw-r--r--usr.bin/learn/lib/editor/L15.2a27
-rw-r--r--usr.bin/learn/lib/editor/L15.2b14
-rw-r--r--usr.bin/learn/lib/editor/L15.2c19
-rw-r--r--usr.bin/learn/lib/editor/L15.2d19
-rw-r--r--usr.bin/learn/lib/editor/L15.3b25
-rw-r--r--usr.bin/learn/lib/editor/L15.3d14
-rw-r--r--usr.bin/learn/lib/editor/L15.3e16
-rw-r--r--usr.bin/learn/lib/editor/L15.3f20
-rw-r--r--usr.bin/learn/lib/editor/L16.1a36
-rw-r--r--usr.bin/learn/lib/editor/L16.1b21
-rw-r--r--usr.bin/learn/lib/editor/L16.1c39
-rw-r--r--usr.bin/learn/lib/editor/L16.2a41
-rw-r--r--usr.bin/learn/lib/editor/L16.2c14
-rw-r--r--usr.bin/learn/lib/editor/L17.2a14
-rw-r--r--usr.bin/learn/lib/editor/L17.2b12
-rw-r--r--usr.bin/learn/lib/editor/L17.2c12
-rw-r--r--usr.bin/learn/lib/editor/L17.2d12
-rw-r--r--usr.bin/learn/lib/editor/L18.1a40
-rw-r--r--usr.bin/learn/lib/editor/L18.2a42
-rw-r--r--usr.bin/learn/lib/editor/L18.2c15
-rw-r--r--usr.bin/learn/lib/editor/L18.2d11
-rw-r--r--usr.bin/learn/lib/editor/L18.2e33
-rw-r--r--usr.bin/learn/lib/editor/L18.3a13
-rw-r--r--usr.bin/learn/lib/editor/L18.3b18
-rw-r--r--usr.bin/learn/lib/editor/L19.1a42
-rw-r--r--usr.bin/learn/lib/editor/L19.1b41
-rw-r--r--usr.bin/learn/lib/editor/L19.2a42
-rw-r--r--usr.bin/learn/lib/editor/L19.2c34
-rw-r--r--usr.bin/learn/lib/editor/L19.2d36
-rw-r--r--usr.bin/learn/lib/editor/L19.2e30
-rw-r--r--usr.bin/learn/lib/editor/L19.2f27
-rw-r--r--usr.bin/learn/lib/editor/L19.3b32
-rw-r--r--usr.bin/learn/lib/editor/L2.1a14
-rw-r--r--usr.bin/learn/lib/editor/L2.2a11
-rw-r--r--usr.bin/learn/lib/editor/L20.1a46
-rw-r--r--usr.bin/learn/lib/editor/L20.2a30
-rw-r--r--usr.bin/learn/lib/editor/L20.2b40
-rw-r--r--usr.bin/learn/lib/editor/L20.2c58
-rw-r--r--usr.bin/learn/lib/editor/L21.1a17
-rw-r--r--usr.bin/learn/lib/editor/L21.1b27
-rw-r--r--usr.bin/learn/lib/editor/L21.1c87
-rw-r--r--usr.bin/learn/lib/editor/L21.1d446
-rw-r--r--usr.bin/learn/lib/editor/L21.1e33
-rw-r--r--usr.bin/learn/lib/editor/L3.1a21
-rw-r--r--usr.bin/learn/lib/editor/L3.1b37
-rw-r--r--usr.bin/learn/lib/editor/L30.1a27
-rw-r--r--usr.bin/learn/lib/editor/L30.1b27
-rw-r--r--usr.bin/learn/lib/editor/L30.2a30
-rw-r--r--usr.bin/learn/lib/editor/L30.2b17
-rw-r--r--usr.bin/learn/lib/editor/L30.2c34
-rw-r--r--usr.bin/learn/lib/editor/L30.2d18
-rw-r--r--usr.bin/learn/lib/editor/L30.2e24
-rw-r--r--usr.bin/learn/lib/editor/L30.2f22
-rw-r--r--usr.bin/learn/lib/editor/L30.2g24
-rw-r--r--usr.bin/learn/lib/editor/L30.2h27
-rw-r--r--usr.bin/learn/lib/editor/L31.1a38
-rw-r--r--usr.bin/learn/lib/editor/L31.2b25
-rw-r--r--usr.bin/learn/lib/editor/L31.2c32
-rw-r--r--usr.bin/learn/lib/editor/L32.1a29
-rw-r--r--usr.bin/learn/lib/editor/L32.1b18
-rw-r--r--usr.bin/learn/lib/editor/L32.1c16
-rw-r--r--usr.bin/learn/lib/editor/L32.2a32
-rw-r--r--usr.bin/learn/lib/editor/L32.2b14
-rw-r--r--usr.bin/learn/lib/editor/L32.2c14
-rw-r--r--usr.bin/learn/lib/editor/L32.2d11
-rw-r--r--usr.bin/learn/lib/editor/L32.2e12
-rw-r--r--usr.bin/learn/lib/editor/L32.2f11
-rw-r--r--usr.bin/learn/lib/editor/L32.2g26
-rw-r--r--usr.bin/learn/lib/editor/L33.1a20
-rw-r--r--usr.bin/learn/lib/editor/L33.1b24
-rw-r--r--usr.bin/learn/lib/editor/L33.2a27
-rw-r--r--usr.bin/learn/lib/editor/L33.2b26
-rw-r--r--usr.bin/learn/lib/editor/L33.2c19
-rw-r--r--usr.bin/learn/lib/editor/L34.1a17
-rw-r--r--usr.bin/learn/lib/editor/L34.1b19
-rw-r--r--usr.bin/learn/lib/editor/L34.2a15
-rw-r--r--usr.bin/learn/lib/editor/L34.2b11
-rw-r--r--usr.bin/learn/lib/editor/L34.2c9
-rw-r--r--usr.bin/learn/lib/editor/L34.2d10
-rw-r--r--usr.bin/learn/lib/editor/L34.2e22
-rw-r--r--usr.bin/learn/lib/editor/L34.2f14
-rw-r--r--usr.bin/learn/lib/editor/L35.1a39
-rw-r--r--usr.bin/learn/lib/editor/L35.2a31
-rw-r--r--usr.bin/learn/lib/editor/L35.2b23
-rw-r--r--usr.bin/learn/lib/editor/L35.2c22
-rw-r--r--usr.bin/learn/lib/editor/L35.2d25
-rw-r--r--usr.bin/learn/lib/editor/L35.2e33
-rw-r--r--usr.bin/learn/lib/editor/L36.1a33
-rw-r--r--usr.bin/learn/lib/editor/L36.2a21
-rw-r--r--usr.bin/learn/lib/editor/L36.2b18
-rw-r--r--usr.bin/learn/lib/editor/L36.2c47
-rw-r--r--usr.bin/learn/lib/editor/L36.2d21
-rw-r--r--usr.bin/learn/lib/editor/L37.1a27
-rw-r--r--usr.bin/learn/lib/editor/L37.2a30
-rw-r--r--usr.bin/learn/lib/editor/L37.2b20
-rw-r--r--usr.bin/learn/lib/editor/L37.2c27
-rw-r--r--usr.bin/learn/lib/editor/L37.2d22
-rw-r--r--usr.bin/learn/lib/editor/L37.2e39
-rw-r--r--usr.bin/learn/lib/editor/L37.2f23
-rw-r--r--usr.bin/learn/lib/editor/L38.1a29
-rw-r--r--usr.bin/learn/lib/editor/L38.2a26
-rw-r--r--usr.bin/learn/lib/editor/L38.2b20
-rw-r--r--usr.bin/learn/lib/editor/L39.1a28
-rw-r--r--usr.bin/learn/lib/editor/L4.1a23
-rw-r--r--usr.bin/learn/lib/editor/L4.1b12
-rw-r--r--usr.bin/learn/lib/editor/L4.2a17
-rw-r--r--usr.bin/learn/lib/editor/L4.2b11
-rw-r--r--usr.bin/learn/lib/editor/L40.1a29
-rw-r--r--usr.bin/learn/lib/editor/L40.1b29
-rw-r--r--usr.bin/learn/lib/editor/L40.2b27
-rw-r--r--usr.bin/learn/lib/editor/L40.2c22
-rw-r--r--usr.bin/learn/lib/editor/L40.2d23
-rw-r--r--usr.bin/learn/lib/editor/L41.1a44
-rw-r--r--usr.bin/learn/lib/editor/L41.1b19
-rw-r--r--usr.bin/learn/lib/editor/L42.1a28
-rw-r--r--usr.bin/learn/lib/editor/L42.2a24
-rw-r--r--usr.bin/learn/lib/editor/L42.2b18
-rw-r--r--usr.bin/learn/lib/editor/L42.2c31
-rw-r--r--usr.bin/learn/lib/editor/L43.1a29
-rw-r--r--usr.bin/learn/lib/editor/L43.2a32
-rw-r--r--usr.bin/learn/lib/editor/L43.2b15
-rw-r--r--usr.bin/learn/lib/editor/L43.2c23
-rw-r--r--usr.bin/learn/lib/editor/L43.2d19
-rw-r--r--usr.bin/learn/lib/editor/L44.1a43
-rw-r--r--usr.bin/learn/lib/editor/L44.1b35
-rw-r--r--usr.bin/learn/lib/editor/L44.1c49
-rw-r--r--usr.bin/learn/lib/editor/L44.1d54
-rw-r--r--usr.bin/learn/lib/editor/L44.1e26
-rw-r--r--usr.bin/learn/lib/editor/L44.1f32
-rw-r--r--usr.bin/learn/lib/editor/L44.1g121
-rw-r--r--usr.bin/learn/lib/editor/L44.1h29
-rw-r--r--usr.bin/learn/lib/editor/L44.1i19
-rw-r--r--usr.bin/learn/lib/editor/L45.1a36
-rw-r--r--usr.bin/learn/lib/editor/L45.1b34
-rw-r--r--usr.bin/learn/lib/editor/L5.1a29
-rw-r--r--usr.bin/learn/lib/editor/L50.1a36
-rw-r--r--usr.bin/learn/lib/editor/L50.1b31
-rw-r--r--usr.bin/learn/lib/editor/L50.1c54
-rw-r--r--usr.bin/learn/lib/editor/L50.2c23
-rw-r--r--usr.bin/learn/lib/editor/L50.2d33
-rw-r--r--usr.bin/learn/lib/editor/L50.2e28
-rw-r--r--usr.bin/learn/lib/editor/L50.2f343
-rw-r--r--usr.bin/learn/lib/editor/L50.2g52
-rw-r--r--usr.bin/learn/lib/editor/L51.1a25
-rw-r--r--usr.bin/learn/lib/editor/L51.2a83
-rw-r--r--usr.bin/learn/lib/editor/L51.2b21
-rw-r--r--usr.bin/learn/lib/editor/L51.2c93
-rw-r--r--usr.bin/learn/lib/editor/L52.1a71
-rw-r--r--usr.bin/learn/lib/editor/L52.1b60
-rw-r--r--usr.bin/learn/lib/editor/L52.2a61
-rw-r--r--usr.bin/learn/lib/editor/L52.2b65
-rw-r--r--usr.bin/learn/lib/editor/L52.2c56
-rw-r--r--usr.bin/learn/lib/editor/L53.1a22
-rw-r--r--usr.bin/learn/lib/editor/L53.2b416
-rw-r--r--usr.bin/learn/lib/editor/L54.1a40
-rw-r--r--usr.bin/learn/lib/editor/L54.1b43
-rw-r--r--usr.bin/learn/lib/editor/L55.1a34
-rw-r--r--usr.bin/learn/lib/editor/L56.1a37
-rw-r--r--usr.bin/learn/lib/editor/L57.1a48
-rw-r--r--usr.bin/learn/lib/editor/L6.1a41
-rw-r--r--usr.bin/learn/lib/editor/L6.2a40
-rw-r--r--usr.bin/learn/lib/editor/L6.2b26
-rw-r--r--usr.bin/learn/lib/editor/L60.1a61
-rw-r--r--usr.bin/learn/lib/editor/L60.1b78
-rw-r--r--usr.bin/learn/lib/editor/L60.2a60
-rw-r--r--usr.bin/learn/lib/editor/L60.2b109
-rw-r--r--usr.bin/learn/lib/editor/L60.2c57
-rw-r--r--usr.bin/learn/lib/editor/L60.2d52
-rw-r--r--usr.bin/learn/lib/editor/L61.1a27
-rw-r--r--usr.bin/learn/lib/editor/L62.1a67
-rw-r--r--usr.bin/learn/lib/editor/L62.2a59
-rw-r--r--usr.bin/learn/lib/editor/L62.2b32
-rw-r--r--usr.bin/learn/lib/editor/L62.2c49
-rw-r--r--usr.bin/learn/lib/editor/L63.1a43
-rw-r--r--usr.bin/learn/lib/editor/L63.1b13
-rw-r--r--usr.bin/learn/lib/editor/L63.1c13
-rw-r--r--usr.bin/learn/lib/editor/L63.1d12
-rw-r--r--usr.bin/learn/lib/editor/L63.1e13
-rw-r--r--usr.bin/learn/lib/editor/L64.1a34
-rw-r--r--usr.bin/learn/lib/editor/L64.1b14
-rw-r--r--usr.bin/learn/lib/editor/L65.1a37
-rw-r--r--usr.bin/learn/lib/editor/L66.1a102
-rw-r--r--usr.bin/learn/lib/editor/L7.1a37
-rw-r--r--usr.bin/learn/lib/editor/L7.1b41
-rw-r--r--usr.bin/learn/lib/editor/L7.2c29
-rw-r--r--usr.bin/learn/lib/editor/L70.1a49
-rw-r--r--usr.bin/learn/lib/editor/L70.2a30
-rw-r--r--usr.bin/learn/lib/editor/L70.2b84
-rw-r--r--usr.bin/learn/lib/editor/L70.2c84
-rw-r--r--usr.bin/learn/lib/editor/L70.2d92
-rw-r--r--usr.bin/learn/lib/editor/L70.2e95
-rw-r--r--usr.bin/learn/lib/editor/L70.2f90
-rw-r--r--usr.bin/learn/lib/editor/L70.2g36
-rw-r--r--usr.bin/learn/lib/editor/L71.1a108
-rw-r--r--usr.bin/learn/lib/editor/L72.1a48
-rw-r--r--usr.bin/learn/lib/editor/L72.2a33
-rw-r--r--usr.bin/learn/lib/editor/L72.2b54
-rw-r--r--usr.bin/learn/lib/editor/L72.2c42
-rw-r--r--usr.bin/learn/lib/editor/L72.2d27
-rw-r--r--usr.bin/learn/lib/editor/L73.1a34
-rw-r--r--usr.bin/learn/lib/editor/L74.1a80
-rw-r--r--usr.bin/learn/lib/editor/L8.1a38
-rw-r--r--usr.bin/learn/lib/editor/L8.1b18
-rw-r--r--usr.bin/learn/lib/editor/L8.2a44
-rw-r--r--usr.bin/learn/lib/editor/L8.2b26
-rw-r--r--usr.bin/learn/lib/editor/L8.2c36
-rw-r--r--usr.bin/learn/lib/editor/L9.1a34
-rw-r--r--usr.bin/learn/lib/editor/L9.2a36
-rw-r--r--usr.bin/learn/lib/editor/L9.2b34
-rw-r--r--usr.bin/learn/lib/editor/L9.2d36
-rw-r--r--usr.bin/learn/lib/editor/L9.2e21
-rw-r--r--usr.bin/learn/lib/editor/L9.3c44
242 files changed, 9130 insertions, 0 deletions
diff --git a/usr.bin/learn/lib/editor/L0 b/usr.bin/learn/lib/editor/L0
new file mode 100644
index 00000000000..c1af3e00384
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L0
@@ -0,0 +1,2 @@
+#next
+1.1a 10
diff --git a/usr.bin/learn/lib/editor/L1.1a b/usr.bin/learn/lib/editor/L1.1a
new file mode 100644
index 00000000000..d822fb3d65b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L1.1a
@@ -0,0 +1,21 @@
+#print
+This program will try to help you learn how to use the editor.
+You should really know, before starting this, how to use files
+and how to type.
+There is a "learn files" procedure to teach you about files.
+Just to review, the current directory contains some files
+whose name begins with "do"; they describe something you should do.
+Find out what, do that, and then type "ready".
+#create ohio
+#create do1
+There is a file in this
+directory named for a state.
+#create do2
+Change the name of that file
+to 'iowa'.
+#user
+test ! -r ohio && test -r iowa
+#log
+#next
+2.1a 1
+2.2a 10
diff --git a/usr.bin/learn/lib/editor/L10.1a b/usr.bin/learn/lib/editor/L10.1a
new file mode 100644
index 00000000000..8c892ca42f9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.1a
@@ -0,0 +1,32 @@
+#print
+Often, what you want to do is print an entire file,
+and often you don't know exactly how long it is.
+There is a special abbreviation for this purpose:
+the character
+ $
+refers to the last line in the file, and so
+1,$p prints all of a file.
+Here's a new file. Print it out using the editor
+command 1,$p. Then do the usual w, q, and ready.
+#create Ref
+1,$p
+w
+q
+#create file
+New York Mets Managers
+ Casey Stengel
+ Wes Westrum
+ Gil Hodges
+ Yogi Berra
+ Roy McMillan
+#copyin
+#pipe
+ed file
+#user
+#unpipe
+#uncopyin
+tail -3 .copy >X1
+#cmp X1 Ref
+#log
+#next
+10.1b 10
diff --git a/usr.bin/learn/lib/editor/L10.1b b/usr.bin/learn/lib/editor/L10.1b
new file mode 100644
index 00000000000..8cf203e74d3
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.1b
@@ -0,0 +1,39 @@
+#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
diff --git a/usr.bin/learn/lib/editor/L10.2a b/usr.bin/learn/lib/editor/L10.2a
new file mode 100644
index 00000000000..f60beca6a00
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.2a
@@ -0,0 +1,39 @@
+#print
+Often you want to refer to the last line
+of a file, and you don't know how long it is.
+There is a special address, "$" for this purpose.
+"$" refers to the end of a file. Thus
+ $p
+prints the last line of a file and
+ 1,$p
+prints all of a file.
+Here's another file. Print all of it, and
+then type the usual w, q, and ready.
+Your commands should look like
+ 1,$p
+ w
+ q
+ ready
+#create Ref
+1,$p
+w
+q
+#create file
+New York Mets Managers
+ Casey Stengel
+ Wes Westrum
+ Gil Hodges
+ Yogi Berra
+ Roy McMillan
+#copyin
+#pipe
+ed file
+#user
+#unpipe
+#uncopyin
+tail -3 .copy >X1
+#cmp X1 Ref
+#log
+#next
+10.1b 10
+10.2b 5
diff --git a/usr.bin/learn/lib/editor/L10.2b b/usr.bin/learn/lib/editor/L10.2b
new file mode 100644
index 00000000000..a3b91025522
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.2b
@@ -0,0 +1,30 @@
+#print
+You can of course use "$" with other addresses.
+For example, print from the third line of this file
+through the end; then leave with the usual w, q, and ready.
+#create Ref
+IBM
+Sperry Rand Univac
+Control Data
+Honeywell
+80
+#create file
+Burroughts
+National Cash Register
+IBM
+Sperry Rand Univac
+Control Data
+Honeywell
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -5 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+10.3c 2
+10.2c 5
+10.1b 10
diff --git a/usr.bin/learn/lib/editor/L10.2c b/usr.bin/learn/lib/editor/L10.2c
new file mode 100644
index 00000000000..cf308e70a2a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.2c
@@ -0,0 +1,18 @@
+#print
+And you can also use other kinds of
+addresses with the "$" address.
+For example, you can use ".", or
+combinations with ".", as addresses.
+Consider printing from the current
+line to the end of the file - what
+would the "p" command look like?
+Type "answer COMMAND" where "COMMAND"
+is that command.
+#copyin
+#user
+#uncopyin
+#match .,$p
+#log
+#next
+10.1b 3
+10.3a 0
diff --git a/usr.bin/learn/lib/editor/L10.3a b/usr.bin/learn/lib/editor/L10.3a
new file mode 100644
index 00000000000..24475fce228
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3a
@@ -0,0 +1,27 @@
+#print
+Often you want to refer to the last line
+of the file. You don't have to know the number
+of lines in the file to do that; there
+is a special address, "$", that always
+refers to the last line. So you
+can print the last line of a file with $p;
+try that, then type w, q and ready as usual.
+#create Ref
+This is the end of the file and the line you should print.
+95
+#create file
+ don't print this line
+ or this one
+This is the end of the file and the line you should print.
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+10.3b 5
+10.3c 10
diff --git a/usr.bin/learn/lib/editor/L10.3b b/usr.bin/learn/lib/editor/L10.3b
new file mode 100644
index 00000000000..2e1e174500c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3b
@@ -0,0 +1,36 @@
+#print
+You can print an entire file making use
+of the fact that "$" refers to the last line.
+The command
+ 1,$p
+prints from the first line to the last one,
+or the whole file. Try printing this
+whole file with this command, and
+then typing w, q and ready. Your commands
+should look like
+ 1,$p
+ w
+ q
+ ready
+#create Ref
+1,$p
+w
+q
+#create file
+New York Mets Managers
+ Casey Stengel
+ Wes Westrum
+ Gil Hodges
+ Yogi Berra
+ Roy McMillan
+#copyin
+#pipe
+ed file
+#user
+#unpipe
+#uncopyin
+tail -3 .copy >X1
+#cmp X1 Ref
+#log
+#next
+10.2b 10
diff --git a/usr.bin/learn/lib/editor/L10.3c b/usr.bin/learn/lib/editor/L10.3c
new file mode 100644
index 00000000000..9190d5451a1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3c
@@ -0,0 +1,19 @@
+#print
+Don't forget the use of arithmetic combinations
+with the "p" command. For example, the
+current line is "." and the next line is ".+1";
+do you see how to print the current line and the
+next line with one command? Think of it as "print
+from this line to the next line". Type "answer COMMAND"
+where COMMAND is what your line with "p" will look like.
+#copyin
+#user
+#uncopyin
+#match .,.+1p
+#match .,+p
+#match .,+1p
+#match .,.1p
+#log
+#next
+10.3d 5
+10.1b 10
diff --git a/usr.bin/learn/lib/editor/L10.3d b/usr.bin/learn/lib/editor/L10.3d
new file mode 100644
index 00000000000..f0e458f2b88
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3d
@@ -0,0 +1,13 @@
+#print
+Suppose you wanted to print from the current
+line to the end of the file? What's the command
+for that? Again, type "answer COMMAND" where
+COMMAND is what your line with "p" will look like.
+#copyin
+#user
+#uncopyin
+#match .,$p
+#log
+#next
+10.3e 5
+10.1b 10
diff --git a/usr.bin/learn/lib/editor/L10.3e b/usr.bin/learn/lib/editor/L10.3e
new file mode 100644
index 00000000000..40cb845e504
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3e
@@ -0,0 +1,14 @@
+#print
+Again, remember the possibility of arithmetic
+combinations. If "$" is the last line, what
+is the line before the last line? Type "answer XXX"
+where "XXX" is the way you would refer to the line
+before the last line of the file.
+#copyin
+#user
+#uncopyin
+#match $-1
+#match $-
+#log
+#next
+10.3f 10
diff --git a/usr.bin/learn/lib/editor/L10.3f b/usr.bin/learn/lib/editor/L10.3f
new file mode 100644
index 00000000000..28526fae925
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L10.3f
@@ -0,0 +1,32 @@
+#print
+How would you print from the first line of a file to
+the next to last line (thus printing all but the last
+line of something)? I'll put you in the editor - do that
+and then type the usual w, q and ready.
+#create Ref
+Boroughs
+ Manhattan
+ Brooklyn
+ Queens
+ the Bronx
+ Staten Island
+92
+#create file
+Boroughs
+ Manhattan
+ Brooklyn
+ Queens
+ the Bronx
+ Staten Island
+Don't print this line!
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -7 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+10.1b 5
diff --git a/usr.bin/learn/lib/editor/L11.1a b/usr.bin/learn/lib/editor/L11.1a
new file mode 100644
index 00000000000..37b68b177d0
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L11.1a
@@ -0,0 +1,44 @@
+#print
+By now you are probably wondering how you
+get into the editor if someone else doesn't put
+you there. The main command interpreter (the shell)
+recognizes
+ ed
+as the name of the editor. (On some systems, it's
+also called "e", which is a useful abbreviation.)
+You can give a file name,
+which becomes the current file. Thus
+ ed NAME
+in response to $ puts you in the editor with
+current file as specified by NAME.
+So you can print a file with the sequence
+ ed file
+ 1,$p
+ w
+ q
+All right. There is a file in the current
+directory named for a New Jersey city. Print
+it with "cat" and then with the editor.
+Then type "ready".
+#create Ref
+2 cups sifted all-purpose flour
+1 tablespoon double-acting baking powder
+1/2 teaspoon salt
+1/4 cup butter
+3/4 cup milk
+119
+#create trenton
+2 cups sifted all-purpose flour
+1 tablespoon double-acting baking powder
+1/2 teaspoon salt
+1/4 cup butter
+3/4 cup milk
+#copyout
+#user
+#uncopyout
+tail -6 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+12.1a 10
+12.2a 5
diff --git a/usr.bin/learn/lib/editor/L11.2a b/usr.bin/learn/lib/editor/L11.2a
new file mode 100644
index 00000000000..d1c77ba955d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L11.2a
@@ -0,0 +1,48 @@
+#print
+So far I have always put you into the editor.
+How do you get there yourself? The main command
+interpreter (the shell) recognizes
+ ed
+as the name of the editor. (On some systems,
+it is also called "e", which is a useful abbreviation.)
+You can also say
+ ed file1
+which put you in the editor with the current file
+"file1". So, for example, you can print the
+last line of a file with
+ ed NAME
+ $p
+ w
+ q
+where NAME is the name of the file.
+
+In this directory is a file named "file45". Print the
+last line of it, and then exit as above.
+#create Ref
+This file contains nothing
+of great importance and
+you should not be printing
+these lines because the only
+line that you were asked for
+was
+this line, the last line.
+#create file45
+This file contains nothing
+of great importance and
+you should not be printing
+these lines because the only
+line that you were asked for
+was
+this line, the last line.
+#copyout
+#pipe
+#user
+#unpipe
+#uncopyout
+grep last .ocopy >X1
+tail -1 Ref >X2
+#cmp X1 X2
+#log
+#next
+11.2b 10
+12.2a 5
diff --git a/usr.bin/learn/lib/editor/L11.2b b/usr.bin/learn/lib/editor/L11.2b
new file mode 100644
index 00000000000..c9d71b9d677
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L11.2b
@@ -0,0 +1,28 @@
+#print
+You can clearly print a whole file
+with
+ e filename
+ 1,$p
+ w
+ q
+which prints a file, just as "cat filename"
+does. Print the file "stuff" using the
+editor.
+Then type "ready".
+#create Ref
+Actually this file is a very
+short file and prints quickly.
+60
+#create stuff
+Actually this file is a very
+short file and prints quickly.
+#copyout
+#pipe
+#user
+#unpipe
+#uncopyout
+tail -3 .ocopy >X2
+#cmp X2 Ref
+#log
+#next
+11.2c 10
diff --git a/usr.bin/learn/lib/editor/L11.2c b/usr.bin/learn/lib/editor/L11.2c
new file mode 100644
index 00000000000..9465ec48113
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L11.2c
@@ -0,0 +1,30 @@
+#print
+You can of course execute other shell commands
+before going into the editor. For example,
+in this directory there is a file named for a New Jersey
+city. Find out what file it is; then print it with "cat"
+and with the editor to check the listings are the same.
+Then type "ready".
+#create Ref
+2 cups sifted all-purpose flour
+1 tablespoon double-acting baking powder
+1/2 teaspoon salt
+1/4 cup butter
+3/4 cup milk
+#create trenton
+2 cups sifted all-purpose flour
+1 tablespoon double-acting baking powder
+1/2 teaspoon salt
+1/4 cup butter
+3/4 cup milk
+#copyout
+#pipe
+#user
+#unpipe
+#uncopyout
+grep '....' .ocopy | tail -5 >X1
+#cmp X1 Ref
+#log
+#next
+12.1a 10
+12.2a 5
diff --git a/usr.bin/learn/lib/editor/L12.1a b/usr.bin/learn/lib/editor/L12.1a
new file mode 100644
index 00000000000..3d3668c7006
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L12.1a
@@ -0,0 +1,33 @@
+#print
+Each 'w' command typed so far has written the edited material
+back on the same file that it came from originally.
+This can be changed by giving a filename on the 'w' command:
+ w camden
+will write the current editor buffer
+on file 'camden'. What does the following
+sequence of commands do?
+ ed old
+ w new
+ q
+As you can see, it picks up file 'old', and
+writes it on file 'new'. It has the same effect
+as
+ cp old new
+does.
+
+This directory contains a file
+with a name beginning with 'h'. Make a copy
+of that file named 'norman'. Check the copy
+by listing the old and new files with 'cat' before
+you type 'ready'.
+#create harry
+Four score and seven years ago our
+fathers brought forth on this continent
+a new nation, conceived in liberty and
+dedicated to the proposition that
+all men are created equal.
+#user
+#cmp harry norman
+#log
+#next
+12.1b 10
diff --git a/usr.bin/learn/lib/editor/L12.1b b/usr.bin/learn/lib/editor/L12.1b
new file mode 100644
index 00000000000..9fe99fd9193
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L12.1b
@@ -0,0 +1,27 @@
+#print
+This directory still has both files named 'harry'
+and 'norman' in it. You checked that they were
+the same with 'cat'. Now, for an easier time,
+try 'diff'. If it doesn't report any differences,
+you can be sure the files are the same.
+#create harry
+Four score and seven years ago our
+fathers brought forth on this continent
+a new nation, conceived in liberty and
+dedicated to the proposition that
+all men are created equal.
+#create norman
+Four score and seven years ago our
+fathers brought forth on this continent
+a new nation, conceived in liberty and
+dedicated to the proposition that
+all men are created equal.
+Type "ready" when you're done experimenting.
+#copyin
+#user
+#uncopyin
+grep diff .copy >/dev/null
+#log
+#next
+13.1a 10
+13.2a 5
diff --git a/usr.bin/learn/lib/editor/L12.2a b/usr.bin/learn/lib/editor/L12.2a
new file mode 100644
index 00000000000..2395ea727b2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L12.2a
@@ -0,0 +1,39 @@
+#print
+Each 'w' command typed so far has written the edited material
+back on the same file that it came from originally.
+This can be changed by giving a filename on the 'w' command:
+ w camden
+will write the current editor buffer
+on file 'camden'. What does the following
+sequence of commands do?
+ ed old
+ w new
+ q
+As you can see, it picks up file 'old', and
+writes it on file 'new'. It has the same effect
+as
+ cp old new
+does.
+
+In this directory there is a file named "old".
+Copy that file to file "new" with the editor, using
+the commands given above. Check by printing
+both files with "cat" that they are the same.
+Type "ready" when done.
+#create Ref
+Four score and seven years ago our
+fathers brought forth on this continent
+a new nation, conceived in liberty and
+dedicated to the proposition that
+all men are created equal.
+#create old
+Four score and seven years ago our
+fathers brought forth on this continent
+a new nation, conceived in liberty and
+dedicated to the proposition that
+all men are created equal.
+#user
+#cmp old new
+#log
+#next
+12.2b 5
diff --git a/usr.bin/learn/lib/editor/L12.2b b/usr.bin/learn/lib/editor/L12.2b
new file mode 100644
index 00000000000..bedd0431d98
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L12.2b
@@ -0,0 +1,17 @@
+#print
+Now use the editor to copy file "first"
+to file "second".
+Then type "ready".
+#create Ref
+Bell Telephone Laboratories
+ 600 Mountain Avenue
+ Murray Hill, New Jersey 07974
+#create first
+Bell Telephone Laboratories
+ 600 Mountain Avenue
+ Murray Hill, New Jersey 07974
+#user
+#cmp Ref second
+#log
+#next
+12.2c 5
diff --git a/usr.bin/learn/lib/editor/L12.2c b/usr.bin/learn/lib/editor/L12.2c
new file mode 100644
index 00000000000..c6801448bf7
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L12.2c
@@ -0,0 +1,22 @@
+#print
+Again, you can type various commands before
+entering the editor. This directory
+contains a file whose name begins with the
+letter 'h'. Make a copy of that file
+named "norman". Check by printing
+the files, either in the editor or with
+the "cat" command, that they are the same.
+Then type "ready".
+#create harry
+Pushkin
+Tolstoy
+Dostoevsky
+Chekhov
+Gorky
+Pasternak
+Solzhenitsyn
+#user
+#cmp harry norman
+#log
+#next
+12.1b 10
diff --git a/usr.bin/learn/lib/editor/L13.1a b/usr.bin/learn/lib/editor/L13.1a
new file mode 100644
index 00000000000..6a2f4ef4941
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L13.1a
@@ -0,0 +1,32 @@
+#print
+Remember we said that you didn't have to know the
+number of the last line, because '$' could
+always be used for that. What if you want to know
+how long the file is? Well, the editor command
+ $=
+will tell you what '$' is set to, i.e. the number of
+lines in the file. You can find the number of lines in
+any file, then, by editing it and then typing "$=".
+(You then must leave the editor with the usual w,q).
+How many lines are there in file 'henry'? You may want to check
+by listing the file with "cat" as well as by using "$="
+in the editor. Don't forget to leave the editor with
+the usual 'w', 'q'; eventually, type "answer N"
+where N is the number of lines.
+#create henry
+Murray Hill
+Holmdel
+Whippany
+Madison
+Piscataway
+Chester
+Warren
+#copyin
+#pipe
+#user
+#unpipe
+#uncopyin
+#match 7
+#log
+#next
+14.1a 10
diff --git a/usr.bin/learn/lib/editor/L13.2a b/usr.bin/learn/lib/editor/L13.2a
new file mode 100644
index 00000000000..a377edd25e8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L13.2a
@@ -0,0 +1,34 @@
+#print
+Remember that "$" is the last line in
+the current file. Suppose you want to
+know how long the file is, i.e. what the
+number of the last line is. The command
+ $=
+will tell you that. So you can find the
+length of the file "data" by saying
+ ed data
+ $=
+ w
+ q
+Try that; then check by listing the file
+with "cat" to see how long it is. Then type
+"ready".
+#create data
+This is the file
+which you should
+find the number
+of lines in by
+typing "$=" in
+the editor and see
+that it has exactly
+nine lines in it
+when printed.
+#copyout
+#pipe
+#user
+#unpipe
+#uncopyout
+grep 9 .ocopy >/dev/null
+#log
+#next
+13.2b 5
diff --git a/usr.bin/learn/lib/editor/L13.2b b/usr.bin/learn/lib/editor/L13.2b
new file mode 100644
index 00000000000..d4ffbdd4738
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L13.2b
@@ -0,0 +1,23 @@
+#print
+How many lines are there in file "henry"?
+When you find out, leave the editor, and
+then type "answer N" where N is the number
+of lines in file "henry".
+#create henry
+Murray Hill
+Holmdel
+Whippany
+Madison
+Piscataway
+Chester
+Warren
+#copyin
+#pipe
+#user
+#unpipe
+#uncopyin
+#match 7
+#log
+#next
+14.1a 10
+14.2a 5
diff --git a/usr.bin/learn/lib/editor/L14.1a b/usr.bin/learn/lib/editor/L14.1a
new file mode 100644
index 00000000000..9e7b57d220c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L14.1a
@@ -0,0 +1,30 @@
+#print
+You can also use the "=" command to find out what
+the 'current' line is. Since the
+current line is referred to as '.', do you see that
+ .=
+is the appropriate command to print the current line
+number? So if you go through a sequence like
+ 3p
+ .=
+the second command will print '3'. That's not very
+exciting, so why don't you edit file 'roger',
+print the next to last line, and then use '.='
+to find out what it is. Don't forget to exit
+from the editor with w, and then q. Then
+finish by typing "answer N" where
+N is what you found, as usual.
+#create roger
+this is a short
+file containing five lines
+of which
+this line is next to last
+indeed
+#copyin
+#user
+#uncopyin
+#match 4
+#log
+#next
+15.1a 10
+15.2a 5
diff --git a/usr.bin/learn/lib/editor/L14.2a b/usr.bin/learn/lib/editor/L14.2a
new file mode 100644
index 00000000000..57047ed5510
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L14.2a
@@ -0,0 +1,26 @@
+#print
+You can also use the "=" command to find out what
+the 'current' line is. Since the current line
+is named '.', the appropriate command is
+ .=
+and so if you say
+ 3p
+ .=
+the second command will print '3'. Since you should not
+believe what I tell you without checking it, edit file
+"doubt" and type the two commands above, which first
+print line 3 (and incidentally set "." to that line) and
+then ask what number "." is. Then type w, q, ready.
+#create doubt
+you didn't have to print this line
+you didn't have to print this line
+to err is human, to really foul things up takes a computer
+you didn't have to print this line
+you didn't have to print this line
+#copyout
+#user
+#uncopyout
+grep 3 .ocopy >/dev/null
+#log
+#next
+14.2b 5
diff --git a/usr.bin/learn/lib/editor/L14.2b b/usr.bin/learn/lib/editor/L14.2b
new file mode 100644
index 00000000000..28b1249ccfd
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L14.2b
@@ -0,0 +1,23 @@
+#print
+You can use all kinds of addresses with "=" so
+that you can find the number of the last line with
+ $=
+for example. There is a file 'monteverdi' in this
+directory: find out the number of the next to last line.
+Then exit from the editor with w, q and type "answer N"
+where N is the number of the next to last line.
+#create monteverdi
+ madrigals
+ magnificat a 6 voci
+ mass a 4 voci
+ motets
+ l'orfeo
+ psalms
+#copyin
+#user
+#uncopyin
+#match 5
+#log
+#next
+15.1a 10
+15.2a 5
diff --git a/usr.bin/learn/lib/editor/L15.1a b/usr.bin/learn/lib/editor/L15.1a
new file mode 100644
index 00000000000..b70feced46d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.1a
@@ -0,0 +1,35 @@
+#print
+So far you only know how to copy and print existing files
+in the editor, and not how to get started from scratch.
+The 'a' (append) command lets you type in new text.
+For example, the sequence
+ ed file
+ a
+ this is a new line of text
+ .
+ w
+ q
+will append the line
+ this is a new line of text
+to the editor buffer, and then write it on "file".
+(If "file" doesn't already exist, the editor will
+warn you, but it's not an error.)
+Note that the material being added ends with the
+line that just contains a single '.' and that normal
+editor commands then resume. Following this pattern,
+make a file named "pres" that contains the
+line
+
+franklin delano roosevelt
+
+and, after you have written it with a 'w' command,
+and done your 'q', try saying "cat pres" to check that
+you did it right.
+Then type "ready".
+#create Ref
+franklin delano roosevelt
+#user
+#cmp pres Ref
+#log
+#next
+15.1b 10
diff --git a/usr.bin/learn/lib/editor/L15.1b b/usr.bin/learn/lib/editor/L15.1b
new file mode 100644
index 00000000000..7cd6ffe5939
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.1b
@@ -0,0 +1,18 @@
+#print
+You can of course put several lines between the 'a' and the '.'
+to type in lots of text at one time. Here is a set
+of lines: type them in and name the file "fruit".
+Type "ready" when done. Input is ...
+#create Ref
+apple
+peach
+pear
+plum
+nectarine
+orange
+#print Ref
+#user
+#cmp Ref fruit
+#log
+#next
+16.1a 10
diff --git a/usr.bin/learn/lib/editor/L15.2a b/usr.bin/learn/lib/editor/L15.2a
new file mode 100644
index 00000000000..bbc058b4a1c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.2a
@@ -0,0 +1,27 @@
+#print
+So far you have learned how to
+copy and print existing files, and now
+you probably want to know how to add new text
+to a file. The "a" (append) command lets
+you do that. For example, the sequence
+ ed file
+ a
+ A man, a plan, a canal - Panama.
+ .
+ w
+ q
+will append the line
+ A man, a plan, a canal - Panama.
+to the editor buffer, and write it on file "file".
+(If "file" didn't exist already, the editor will
+warn you. It's not an error, just a warning.)
+Try that. Then say "cat file" to check what was written,
+and then type "ready".
+#create Ref
+A man, a plan, a canal - Panama.
+#user
+#cmp file Ref
+#log
+#next
+15.2b 5
+15.3b 2
diff --git a/usr.bin/learn/lib/editor/L15.2b b/usr.bin/learn/lib/editor/L15.2b
new file mode 100644
index 00000000000..d8d5c0c5f1f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.2b
@@ -0,0 +1,14 @@
+#print
+Now make a file containing the line
+
+The Hon. Brendan Byrne
+
+and write it on file "gov".
+Then type "ready".
+#create Ref
+The Hon. Brendan Byrne
+#user
+#cmp gov Ref
+#log
+#next
+15.1b 10
diff --git a/usr.bin/learn/lib/editor/L15.2c b/usr.bin/learn/lib/editor/L15.2c
new file mode 100644
index 00000000000..6f1b013dbce
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.2c
@@ -0,0 +1,19 @@
+#print
+Note that every set of lines to be appended ends
+with the character '.' alone on a line. This is essential
+to get back to editor command level. Whenever you have
+been appending, and you later type a 'p' or 'w' command
+and the editor appears not to respond, check that you
+remember to type the '.' to stop appending. This is a very
+common error even among experienced users. Suppose you type
+in, appending to a file, five lines; what must you type on
+the sixth line before typing 'w'? Type "answer X" where X
+is that character.
+#copyin
+#user
+#uncopyin
+#match .
+#log
+#next
+15.2d 5
+15.3d 2
diff --git a/usr.bin/learn/lib/editor/L15.2d b/usr.bin/learn/lib/editor/L15.2d
new file mode 100644
index 00000000000..a8c6f77ca23
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.2d
@@ -0,0 +1,19 @@
+#print
+As we mentioned, you can add several lines at once. Here is
+a set of lines; go into the editor, append them, write them
+on a file named "fruit", and then leave the editor and
+type "ready".
+#create Ref
+apple
+peach
+pear
+plum
+nectarine
+orange
+#print Ref
+#user
+#cmp Ref fruit
+#log
+#next
+16.1a 10
+15.3e 5
diff --git a/usr.bin/learn/lib/editor/L15.3b b/usr.bin/learn/lib/editor/L15.3b
new file mode 100644
index 00000000000..b7f93e4382b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.3b
@@ -0,0 +1,25 @@
+#print
+You can put several lines betwen the 'a' and the '.', as
+in this example which creates a file named 'opera'.
+ ed opera
+ a
+ abduction from the seraglio - mozart
+ aida - verdi
+ alcina - handel
+ anna bolena - donizetti
+ .
+ w
+ q
+Try this as shown. Then type "ready".
+(Notice the warning that "opera" doesn't exist
+when you start.)
+#create Ref
+abduction from the seraglio - mozart
+aida - verdi
+alcina - handel
+anna bolena - donizetti
+#user
+#cmp opera Ref
+#log
+#next
+15.2c 5
diff --git a/usr.bin/learn/lib/editor/L15.3d b/usr.bin/learn/lib/editor/L15.3d
new file mode 100644
index 00000000000..49bae05564b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.3d
@@ -0,0 +1,14 @@
+#print
+Use the editor to make a file named 'pres' and containing
+the single line
+
+franklin delano roosevelt
+
+and then type "ready".
+#create Ref
+franklin delano roosevelt
+#user
+#cmp pres Ref
+#log
+#next
+15.3e 5
diff --git a/usr.bin/learn/lib/editor/L15.3e b/usr.bin/learn/lib/editor/L15.3e
new file mode 100644
index 00000000000..714d78a6679
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.3e
@@ -0,0 +1,16 @@
+#print
+Remember that after typing the '.' which ends an append
+you can type ordinary commands at the editor. Go into
+the editor; append the line
+
+washington, d.c.
+
+and then print it with the 'p' command. Then write it
+on a file named "city" and leave the editor and type "ready".
+#create Ref
+washington, d.c.
+#user
+#cmp city Ref
+#log
+#next
+15.3f 5
diff --git a/usr.bin/learn/lib/editor/L15.3f b/usr.bin/learn/lib/editor/L15.3f
new file mode 100644
index 00000000000..29020cd2dd2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L15.3f
@@ -0,0 +1,20 @@
+#print
+Now make a file named "towns" that contains the lines
+summit
+chatham
+westfield
+cranford
+madison
+and print it out to check you did it right.
+Then type "ready".
+#create Ref
+summit
+chatham
+westfield
+cranford
+madison
+#user
+#cmp towns Ref
+#log
+#next
+16.1a 10
diff --git a/usr.bin/learn/lib/editor/L16.1a b/usr.bin/learn/lib/editor/L16.1a
new file mode 100644
index 00000000000..ca51bfca3fb
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L16.1a
@@ -0,0 +1,36 @@
+#print
+When you are typing after an 'append' command,
+the editor is no longer listening for its ordinary
+commands. Between 'a' and '.' none of your
+usual 'p', 'w', or 'q' commands are recognized. The only
+thing that will make the editor wake up is to type '.'
+alone on a line. So to type in text, then print it,
+you must go through a sequence like
+ ed file
+ a
+ input text
+ .
+ 1,$p
+ w
+ q
+and you must not type the "1,$p" until you have typed
+the '.'. Do you understand? Will the sequence
+ ed junk
+ a
+ input line
+ $=
+ .
+ w
+ q
+print the number of the last line typed in? If you don't
+know, try it. Then type 'yes' or 'no'.
+#copyin
+#pipe
+#user
+#unpipe
+#uncopyin
+#match no
+#log
+#next
+16.1b 10
+16.2a 5
diff --git a/usr.bin/learn/lib/editor/L16.1b b/usr.bin/learn/lib/editor/L16.1b
new file mode 100644
index 00000000000..776bd62b426
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L16.1b
@@ -0,0 +1,21 @@
+#print
+So far you've only appended to empty files. If the file
+you are appending to has something in it, you have to
+decide where you want the new material to be placed.
+You can give a line address with 'a', and the append
+command will place the new material after that line.
+For example,
+ 3a
+ input
+ .
+places 'input' after line 3. What will be the line
+number of the input line? Type 'answer N', as usual.
+#pipe
+#copyin
+#user
+#uncopyin
+#unpipe
+#match 4
+#log
+#next
+16.1c 10
diff --git a/usr.bin/learn/lib/editor/L16.1c b/usr.bin/learn/lib/editor/L16.1c
new file mode 100644
index 00000000000..86dfcbe3a65
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L16.1c
@@ -0,0 +1,39 @@
+#print
+The current directory contains a file
+named 'hand'. The third line is missing:
+add the line
+
+middle finger
+
+after line 2 of this file.
+Check what you're doing by printing the file
+with
+ 1,$p
+before and after the change.
+Then rewrite the file with the usual w, q,
+and then type "ready".
+#create Ref
+thumb
+index finger
+middle finger
+ring finger
+little finger
+#create hand
+thumb
+index finger
+ring finger
+little finger
+#create rhand
+thumb
+index finger
+ring finger
+little finger
+#pipe
+#user
+#unpipe
+#cmp hand Ref
+#log
+#next
+17.2a 5
+18.1a 10
+18.2a 7
diff --git a/usr.bin/learn/lib/editor/L16.2a b/usr.bin/learn/lib/editor/L16.2a
new file mode 100644
index 00000000000..f5121add08d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L16.2a
@@ -0,0 +1,41 @@
+#print
+So far you have always appended to an empty file,
+so that there was no problem about where the appended lines
+were placed in the file. If the file you're appending to
+already has lines in it, you can say where you want the
+new material to be placed by giving a line address with 'a',
+and you can check on this by printing the file.
+Try the following sequence and note what happens to the new lines
+that are added with the "3a" command:
+
+ed rivers
+1,$p
+3a
+merrimack
+connecticut
+hudson
+.
+1,$p
+w
+q
+ready
+#create Ref
+penobscot
+androscoggin
+kennebec
+merrimack
+connecticut
+hudson
+delaware
+susquehanna
+#create rivers
+penobscot
+androscoggin
+kennebec
+delaware
+susquehanna
+#user
+#cmp rivers Ref
+#log
+#next
+16.2c 5
diff --git a/usr.bin/learn/lib/editor/L16.2c b/usr.bin/learn/lib/editor/L16.2c
new file mode 100644
index 00000000000..8a345a229a0
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L16.2c
@@ -0,0 +1,14 @@
+#print
+You can see that the 'a' command adds lines after the
+line addressed. So if you type
+ 2a
+at the editor, what will be the line number of the
+first line that you added? Type "answer N" where N is the
+number it will have.
+#copyin
+#user
+#uncopyin
+#match 3
+#log
+#next
+16.1c 5
diff --git a/usr.bin/learn/lib/editor/L17.2a b/usr.bin/learn/lib/editor/L17.2a
new file mode 100644
index 00000000000..5d6332b9ab1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L17.2a
@@ -0,0 +1,14 @@
+#print
+You must always remember what the computer is expecting
+from you: shell commands, editor commands, or input
+text after an 'append'. Suppose you are
+typing append text: what do you type to get
+back to where you can type editor commands? Type
+"answer X" where "X" is replaced by what you type.
+#copyin
+#user
+#uncopyin
+#match .
+#log
+#next
+17.2b 5
diff --git a/usr.bin/learn/lib/editor/L17.2b b/usr.bin/learn/lib/editor/L17.2b
new file mode 100644
index 00000000000..78b480fd04a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L17.2b
@@ -0,0 +1,12 @@
+#print
+What do you type to go from
+the editor command level to where
+you type input text? (The append command).
+Type "answer X" where X is what you type.
+#copyin
+#user
+#uncopyin
+#match a
+#log
+#next
+17.2c 5
diff --git a/usr.bin/learn/lib/editor/L17.2c b/usr.bin/learn/lib/editor/L17.2c
new file mode 100644
index 00000000000..bf0351be6fe
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L17.2c
@@ -0,0 +1,12 @@
+#print
+What command do you type to go from the
+shell to the editor? Type "answer X" where
+X is the command name.
+#copyin
+#user
+#uncopyin
+#match e
+#match ed
+#log
+#next
+17.2d 5
diff --git a/usr.bin/learn/lib/editor/L17.2d b/usr.bin/learn/lib/editor/L17.2d
new file mode 100644
index 00000000000..0d38499f535
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L17.2d
@@ -0,0 +1,12 @@
+#print
+And, finally, what is the last line you type
+to go to the shell from the editor? Again, respond
+"answer X" where X is the command.
+#copyin
+#user
+#uncopyin
+#match q
+#log
+#next
+18.1a 10
+18.2a 5
diff --git a/usr.bin/learn/lib/editor/L18.1a b/usr.bin/learn/lib/editor/L18.1a
new file mode 100644
index 00000000000..488a804ec15
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.1a
@@ -0,0 +1,40 @@
+#print
+Sometimes it is desirable to add text before a
+known line, rather than after it. For this purpose
+there is an 'i' (insert) command that places the new
+material before the specified line. Otherwise, 'i'
+is exactly like 'a', so that
+ 3i
+is the same as
+ 2a
+Remember the address of the last line? Just
+before the last line of file 'airlines'
+insert the line
+
+twa
+
+and then rewrite the file with w, q, and type ready.
+#create Ref
+american
+braniff
+continental
+delta
+eastern
+national
+pan am
+twa
+united
+#create airlines
+american
+braniff
+continental
+delta
+eastern
+national
+pan am
+united
+#user
+#cmp airlines Ref
+#log
+#next
+19.1a 10
diff --git a/usr.bin/learn/lib/editor/L18.2a b/usr.bin/learn/lib/editor/L18.2a
new file mode 100644
index 00000000000..dafb343cd45
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.2a
@@ -0,0 +1,42 @@
+#print
+Once in a while you want to add text just before
+a certain line, rather than just after it. For this purpose
+there is a command 'i' (insert) which is just like 'a'
+except that the new material goes before the addressed line,
+instead of after it. For example,
+ 3i
+is the same as
+ 2a
+Try this sequence, which prints the editor buffer before
+and after the insertion, to see what happens.
+
+ed cars
+1,$p
+3i
+lincoln
+chevrolet
+.
+1,$p
+w
+q
+ready
+#create Ref
+ford
+mercury
+lincoln
+chevrolet
+buick
+pontiac
+oldsmobile
+#create cars
+ford
+mercury
+buick
+pontiac
+oldsmobile
+#user
+#cmp cars Ref
+#log
+#next
+18.2c 7
+18.3a 3
diff --git a/usr.bin/learn/lib/editor/L18.2c b/usr.bin/learn/lib/editor/L18.2c
new file mode 100644
index 00000000000..5a4bc25ffd1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.2c
@@ -0,0 +1,15 @@
+#print
+Again, remembering that "5i" is the same as "4a"
+what command is the same as
+ .-1a
+to the editor? Respond "answer XX" where XX is that
+command.
+#copyin
+#user
+#uncopyin
+#match i
+#match .i
+#log
+#next
+18.2d 2
+18.2e 6
diff --git a/usr.bin/learn/lib/editor/L18.2d b/usr.bin/learn/lib/editor/L18.2d
new file mode 100644
index 00000000000..6da3437aeef
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.2d
@@ -0,0 +1,11 @@
+#print
+What command will insert lines before the second line from the
+end of the file? Type "answer XXX" where XXX is that command.
+#copyin
+#user
+#uncopyin
+#match $-2i
+#match $-3a
+#log
+#next
+18.2e 5
diff --git a/usr.bin/learn/lib/editor/L18.2e b/usr.bin/learn/lib/editor/L18.2e
new file mode 100644
index 00000000000..fd06297bb01
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.2e
@@ -0,0 +1,33 @@
+#print
+Just before the last line of file 'airlines'
+in this directory insert the line
+
+twa
+
+and then rewrite the file with w, q, and
+type "ready".
+#create Ref
+american
+braniff
+continental
+delta
+eastern
+national
+pan am
+twa
+united
+#create airlines
+american
+braniff
+continental
+delta
+eastern
+national
+pan am
+united
+#user
+#cmp airlines Ref
+#log
+#next
+19.1a 10
+19.2a 5
diff --git a/usr.bin/learn/lib/editor/L18.3a b/usr.bin/learn/lib/editor/L18.3a
new file mode 100644
index 00000000000..3b6378d6e99
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.3a
@@ -0,0 +1,13 @@
+#print
+Since 'i' is the same as 'a' except for the position
+of the inserted material, what character must end
+every block of lines inserted with the 'i' command?
+Type "answer X" where X is that character.
+#copyin
+#user
+#uncopyin
+#match .
+#log
+#next
+18.3b 5
+18.2c 10
diff --git a/usr.bin/learn/lib/editor/L18.3b b/usr.bin/learn/lib/editor/L18.3b
new file mode 100644
index 00000000000..2656f6de480
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L18.3b
@@ -0,0 +1,18 @@
+#print
+Remembering that 'i' inserts one line before
+the 'a' command, so that after
+ 3a
+the first input line is number 4 while after
+ 3i
+the first input line is number 3, what command
+using 'i' is the same as the command
+ 5a
+to the editor? Type "answer XX" where XX is that
+command.
+#copyin
+#user
+#uncopyin
+#match 6i
+#log
+#next
+18.2c 5
diff --git a/usr.bin/learn/lib/editor/L19.1a b/usr.bin/learn/lib/editor/L19.1a
new file mode 100644
index 00000000000..7d83c3ba7e6
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.1a
@@ -0,0 +1,42 @@
+#print
+Now that you know how to add lines to a file,
+you will want to know how to get rid of them.
+The command
+ 5d
+will delete line 5 of a file. The command
+ .d
+will delete the current line.
+In the file 'pres' either the 5th or 6th line
+is wrong. Print those lines and delete the bad
+one; then rewrite the corrected file.
+Then type 'ready'.
+#create Ref
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+andrew jackson
+martin van buren
+william henry harrison
+john tyler
+#create pres
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+ this is wrong Qwertyuiop
+john quincy adams
+andrew jackson
+martin van buren
+william henry harrison
+john tyler
+#pipe
+#user
+#unpipe
+#cmp pres Ref
+#log
+#next
+19.1b 10
diff --git a/usr.bin/learn/lib/editor/L19.1b b/usr.bin/learn/lib/editor/L19.1b
new file mode 100644
index 00000000000..3fd0369da4d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.1b
@@ -0,0 +1,41 @@
+#print
+Just as you can print several lines at once by
+giving a range of addresses with the 'p' command,
+you can delete several lines at once by giving
+two addresses. For example,
+ 2,5d
+deletes lines 2, 3, 4 and 5 of the current file. The
+command
+ 1,.-1d
+deletes all lines up to but not including the current line.
+And
+ 1,$d
+deletes EVERY line. (Use with extreme caution, obviously.)
+There is a file named 'counties' in this directory.
+Throw away the first five lines of it and rewrite it.
+Then type 'ready' as usual.
+#create Ref
+Morris
+Warren
+Union
+Somerset
+Hunterdon
+#create counties
+Bergen
+Passaic
+Sussex
+Hudson
+Essex
+Morris
+Warren
+Union
+Somerset
+Hunterdon
+#pipe
+#user
+#unpipe
+#cmp counties Ref
+#log
+#next
+20.1a 10
+20.2a 5
diff --git a/usr.bin/learn/lib/editor/L19.2a b/usr.bin/learn/lib/editor/L19.2a
new file mode 100644
index 00000000000..263d6b086d9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.2a
@@ -0,0 +1,42 @@
+#print
+To avoid just accumulating lines forever, you need some
+way of getting rid of them. The 'd' command (delete) removes
+lines you don't want. Since it also removes lines that
+you do want if you tell it to, you should be careful
+with this command. Deleting one line at a time
+is always pretty safe. For example
+ 5d
+will delete line 5 of a file. Try the following
+sequence; note that I've used "cat"
+for a change.
+
+cat bmt
+ed bmt
+5d
+w
+q
+cat bmt
+ready
+#create Ref
+14th st
+23rd st
+28th st
+34th st
+times square
+49th st
+57th st
+#create bmt
+14th st
+23rd st
+28th st
+34th st
+42nd st
+times square
+49th st
+57th st
+#user
+#cmp bmt Ref
+#log
+#next
+19.3b 3
+19.2c 8
diff --git a/usr.bin/learn/lib/editor/L19.2c b/usr.bin/learn/lib/editor/L19.2c
new file mode 100644
index 00000000000..cabcce8863a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.2c
@@ -0,0 +1,34 @@
+#print
+In this directory there is a file "pres" in which
+either the 5th line or the 6th line does not
+belong. Edit the file, print the dubious lines,
+delete the bad one, and then rewrite the file.
+Then type "ready".
+#create Ref
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+andrew jackson
+martin van buren
+william henry harrison
+john tyler
+#create pres
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+ this is wrong Qwertyuiop
+john quincy adams
+andrew jackson
+martin van buren
+william henry harrison
+john tyler
+#user
+#cmp pres Ref
+#log
+#next
+19.2d 5
diff --git a/usr.bin/learn/lib/editor/L19.2d b/usr.bin/learn/lib/editor/L19.2d
new file mode 100644
index 00000000000..c9207ac60df
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.2d
@@ -0,0 +1,36 @@
+#print
+You can delete several lines at once by giving a range
+of addresses with the 'd' command. For example, the sequence
+
+ed howto
+2,5d
+w
+q
+
+will delete lines 2 through 5 of the file "howto" and write
+the shorter material on the file "new". Try that. Then say
+
+cat howto
+cat new
+
+to see the differences; then type "ready".
+#create Ref
+To use UNIX:
+5. dial ext. 4321
+6. type userid in response to login
+7. type commands
+#create howto
+To use UNIX:
+1. turn terminal power on
+2. check terminal is in "line" mode
+3. check duplex switch in "full" position
+4. check baud rate at "300"
+5. dial ext. 4321
+6. type userid in response to login
+7. type commands
+#user
+#cmp new Ref
+#log
+#next
+19.2e 5
+20.1a 10
diff --git a/usr.bin/learn/lib/editor/L19.2e b/usr.bin/learn/lib/editor/L19.2e
new file mode 100644
index 00000000000..3253fcc67ef
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.2e
@@ -0,0 +1,30 @@
+#print
+Now, for comparison, use the "diff" command to
+check on the differences between "howto" and "new".
+Try typing
+
+diff howto new
+
+and then "ready".
+#create howto
+To use UNIX:
+1. turn terminal power on
+2. check terminal is in "line" mode
+3. check duplex switch in "full" position
+4. check baud rate at "300"
+5. dial ext. 4321
+6. type userid in response to login
+7. type commands
+#create new
+To use UNIX:
+5. dial ext. 4321
+6. type userid in response to login
+7. type commands
+#copyin
+#user
+#uncopyin
+#match diff howto new
+#match diff new howto
+#log
+#next
+19.2f
diff --git a/usr.bin/learn/lib/editor/L19.2f b/usr.bin/learn/lib/editor/L19.2f
new file mode 100644
index 00000000000..0a2b6c96f0a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.2f
@@ -0,0 +1,27 @@
+#print
+There is a file "counties" in this directory.
+Try deleting the first five lines of the file.
+Then type "ready".
+#create Ref
+Morris
+Warren
+Union
+Somerset
+Hunterdon
+#create counties
+Bergen
+Passaic
+Sussex
+Hudson
+Essex
+Morris
+Warren
+Union
+Somerset
+Hunterdon
+#user
+#cmp counties Ref
+#log
+#next
+20.1a 10
+20.2a 5
diff --git a/usr.bin/learn/lib/editor/L19.3b b/usr.bin/learn/lib/editor/L19.3b
new file mode 100644
index 00000000000..6b6a676e180
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L19.3b
@@ -0,0 +1,32 @@
+#print
+You can use any other kind of address you want
+with 'd'; for example,
+ .d
+will delete the current line. Remember the
+name of the last line? Pick up file
+"flower" and delete the last line and
+rewrite the file. Then type "ready".
+#create Ref
+aster
+chrysanthemum
+daffodil
+marigold
+petunia
+rose
+tulip
+zinnia
+#create flower
+aster
+chrysanthemum
+daffodil
+marigold
+petunia
+rose
+tulip
+zinnia
+hummingbird
+#user
+#cmp flower Ref
+#log
+#next
+19.2c 10
diff --git a/usr.bin/learn/lib/editor/L2.1a b/usr.bin/learn/lib/editor/L2.1a
new file mode 100644
index 00000000000..387c70e2c01
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L2.1a
@@ -0,0 +1,14 @@
+#print
+Now to check that you can type, a line will
+be typed at you: type it back in, and then type "ready".
+Type the line exactly as it is typed at you, including
+the colons that bracket it.
+
+: pack my box with five dozen liquor jugs :
+#copyin
+#user
+#uncopyin
+#match : pack my box with five dozen liquor jugs :
+#log
+#next
+3.1a 10
diff --git a/usr.bin/learn/lib/editor/L2.2a b/usr.bin/learn/lib/editor/L2.2a
new file mode 100644
index 00000000000..c25bc1037f1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L2.2a
@@ -0,0 +1,11 @@
+#print
+As an easier typing test, see if you can just get
+the word "management" in correctly. Type it
+in response to "$" and then type "ready".
+#copyin
+#user
+#uncopyin
+#match management
+#log
+#next
+3.1a 10
diff --git a/usr.bin/learn/lib/editor/L20.1a b/usr.bin/learn/lib/editor/L20.1a
new file mode 100644
index 00000000000..d2aa4f43e04
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L20.1a
@@ -0,0 +1,46 @@
+#print
+You can now change a line of a file, using only the
+commands already taught, by deleting the old line
+and inserting a new one.
+This is not a very convenient way to do that, so
+there is a command 'c' (change) which combines
+those operations.
+ 5c
+ input text
+ here.
+ .
+will delete line 5 and replace it by the lines
+
+input text
+here.
+
+Note that the text following 'c', just like the text
+after 'i' and 'a', must end with a line containing just
+one '.' and nothing else.
+This directory contains a file named 'short'
+with six lines in it. Change the last line to read
+
+new version of last line
+
+and rewrite the file; then end with "ready".
+#create Ref
+This is a short file
+which contains exactly
+six lines of text
+of which you are
+to change the last line
+new version of last line
+#create short
+This is a short file
+which contains exactly
+six lines of text
+of which you are
+to change the last line
+this is the last line.
+#pipe
+#user
+#unpipe
+#cmp Ref short
+#log
+#next
+21.1a 10
diff --git a/usr.bin/learn/lib/editor/L20.2a b/usr.bin/learn/lib/editor/L20.2a
new file mode 100644
index 00000000000..58ba72f3e65
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L20.2a
@@ -0,0 +1,30 @@
+#print
+You can now change a line of a file by a slow procedure: delete the
+old version and insert the new one. For example, you could replace
+line 4 of a file with
+ 4d
+ 3a
+ new version of line 4
+ .
+right? OK, try that. There is a file named "words" in this
+directory and line 4 contains a mistyped word. Correct it and
+rewrite the file; then type "ready".
+#create Ref
+bear
+begin
+belief
+believe
+belt
+bend
+#create words
+bear
+begin
+belief
+beleive
+belt
+bend
+#user
+#cmp words Ref
+#log
+#next
+20.2b 5
diff --git a/usr.bin/learn/lib/editor/L20.2b b/usr.bin/learn/lib/editor/L20.2b
new file mode 100644
index 00000000000..0c361b561cd
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L20.2b
@@ -0,0 +1,40 @@
+#print
+There is an easier way to do that. You can just say
+ 5c
+ input text for new version
+ .
+using the 'c' command ('c' stands for 'change') which
+will delete the old version of the line and
+replace it. Note that the input text after 'c' ends
+with a '.' just like the text after the 'a' or 'i' commands.
+This directory contains a file named "lineup". Change
+the third line to read "neal walk" and print the file
+before and after. Use a sequence like this, ending in ready:
+
+ed lineup
+1,$p
+3c
+neal walk
+.
+1,$p
+w
+q
+ready
+
+#create Ref
+walt frazier
+earl monroe
+neal walk
+bill bradley
+spencer haywood
+#create lineup
+walt frazier
+earl monroe
+john gianelli
+bill bradley
+spencer haywood
+#user
+#cmp lineup Ref
+#log
+#next
+20.2c 5
diff --git a/usr.bin/learn/lib/editor/L20.2c b/usr.bin/learn/lib/editor/L20.2c
new file mode 100644
index 00000000000..35055bf3c5e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L20.2c
@@ -0,0 +1,58 @@
+#print
+You can also change several lines, and you need not replace
+lines with the same number of lines. You can put any amount
+of text between the 'c' command and the closing '.', and
+you can remove any number of lines from the file by specifying
+a range of addresses. For example,
+
+ 2,5c
+ first
+ second
+ .
+would replace the FOUR lines 2,3,4 and 5 of the file with TWO
+new lines containing "first" and "second". You can of course
+use more complicated addresses involving $ and . if you wish.
+This directory contains a file "oldrr". Delete the last two
+lines and replace them by a line reading
+
+penn central
+
+and write the new version on a file named "newrr". Then use "diff"
+to compare the old and new versions of the file.
+Eventually, type "ready".
+#create Ref
+maine central
+bangor and aroostook
+boston and maine
+grand trunk
+vermont central
+boston and albany
+new haven
+delaware and hudson
+new york, susquehanna, and western
+erie-lackawanna
+chessie system
+lehigh valley
+long island railroad
+penn central
+#create oldrr
+maine central
+bangor and aroostook
+boston and maine
+grand trunk
+vermont central
+boston and albany
+new haven
+delaware and hudson
+new york, susquehanna, and western
+erie-lackawanna
+chessie system
+lehigh valley
+long island railroad
+new york central
+pennsylvania
+#user
+#cmp newrr Ref
+#log
+#next
+21.1a 10
diff --git a/usr.bin/learn/lib/editor/L21.1a b/usr.bin/learn/lib/editor/L21.1a
new file mode 100644
index 00000000000..d4785d6328c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L21.1a
@@ -0,0 +1,17 @@
+#print
+Remember all the basic commands: 'e', 'a', 'w' and 'q'.
+Make a file named 'test' that contains the following lines, exactly
+as presented below. Then type "ready".
+#create Ref
+maine
+new hampshire
+vermont
+massachusetts
+rhode island
+connecticut
+#print Ref
+#user
+#cmp Ref test
+#log
+#next
+21.1b 5
diff --git a/usr.bin/learn/lib/editor/L21.1b b/usr.bin/learn/lib/editor/L21.1b
new file mode 100644
index 00000000000..3f6d5a27e68
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L21.1b
@@ -0,0 +1,27 @@
+#print
+In this directory there is a file 'fix'. It contains
+a mistyped line. Print the file; then change that
+line and rewrite the file correctly.
+Then type "ready".
+#create Ref
+Bell System Companies include:
+American Telephone and Telegraph Company
+ Long Lines Division
+Western Electric Company
+Bell Laboratories
+Teletype Corporation
+Associated Companies
+#create fix
+Bell System Companies include:
+American Telephone and Telegraph Company
+ Long Lines Division
+Western Electric Company
+Bell Lxxxxtories
+Teletype Corporation
+Associated Companies
+#user
+#cmp Ref fix
+#log
+#next
+21.1c 5
+21.1e 10
diff --git a/usr.bin/learn/lib/editor/L21.1c b/usr.bin/learn/lib/editor/L21.1c
new file mode 100644
index 00000000000..0ea6579497d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L21.1c
@@ -0,0 +1,87 @@
+#print
+This directory contains a file "list" which has
+a list of words in it. What word is on the last line
+of the file? The file is rather long - I'd suggest you
+not try to print all of it. Type "answer WORD" where
+WORD is the word on the last line of the file.
+#create list
+aardvark
+adapt
+addition
+alert
+allege
+alphabet
+announce
+answer
+apple
+architect
+arrange
+avoid
+this
+is
+going
+to
+be
+very
+boring
+if
+you
+keep
+trying
+to
+print
+the
+whole
+file
+you
+should
+have
+said
+$p
+and
+I
+would
+suggest
+you
+hit
+delete
+now
+and
+try
+that
+instead
+i
+am
+very
+patient
+and
+you
+are
+not
+going
+to
+like
+waiting
+for
+all
+of
+this
+to
+go
+on
+for
+ver
+...
+...
+..
+...
+year
+youth
+zebra
+#copyin
+#user
+#uncopyin
+#match zebra
+#log
+#next
+21.1d 5
diff --git a/usr.bin/learn/lib/editor/L21.1d b/usr.bin/learn/lib/editor/L21.1d
new file mode 100644
index 00000000000..4b7d67340f4
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L21.1d
@@ -0,0 +1,446 @@
+#print
+How long is file "text"? (That is,
+how many lines does it have, or what
+is the line number of the last line.) Remember the
+"=" command? This file is also too long for you
+to print out in full.
+Type "answer N" where N is the number of the last
+line.
+#create text
+a
+able
+about
+above
+absolutely
+accidents
+act
+add
+administered
+admiration
+adoring
+advancing
+adventure
+advised
+after
+afternoon
+afterward
+again
+against
+agent
+alacrity
+all
+allow
+almost
+alone
+along
+alongside
+alp-climbers
+alpenstock
+alpine
+alps
+already
+also
+alter
+although
+am
+among
+an
+and
+animal
+animals
+another
+anxiety?
+any
+apparent
+applause
+appointed
+appreciation
+are
+argued
+armor-bearers
+around
+arrange
+arrived
+article
+as
+ascend
+ascending
+ascent
+aside
+asked
+assailed
+assaulting
+assembled
+assist
+at
+attempt
+attended
+attention
+attracted
+avalanches
+away
+awful
+back
+badly
+baffled
+barometer
+barrier
+battered
+battle
+be
+beautiful
+because
+become
+bed
+been
+before
+began
+beginning
+behind
+being
+believed
+beneficent
+better
+between
+big
+bitter
+black
+blue
+book
+both
+boughs
+brass
+break
+breast
+breath
+bridge
+bringing
+broke
+broken
+brought
+burdens
+burst
+but
+by
+called
+calmly
+came
+can
+cannot
+caravan
+carpeted
+carried
+case
+catch
+caught
+caused
+cavalcade
+ceased
+cellar
+center
+certainly
+chair
+chance
+change
+chaplain
+cheered
+chief
+chilly
+church
+circumstance
+citizens
+civilization
+clear
+clearly
+climb
+climber
+clock
+closed
+clove
+coil
+cold
+column
+comfort
+command
+commanded
+commended
+concluded
+condition
+confronted
+consequently
+considerable
+considered
+consisted
+constantly
+consulting
+contrived
+convinced
+cord
+could
+country
+couple
+courage
+course
+cover
+covered
+cows
+crash
+crawling
+crept
+crippling
+crossed
+crowd
+crowded
+cruel
+crumbly
+crutches
+custom
+cut
+danger
+dangerous
+dark
+dead
+deaf
+dear
+decided
+decked
+declared
+deep
+deeply
+defective
+demanded
+demoralization
+densely
+deployed
+descending
+describe
+desert
+deserted
+despair
+despondency
+detachment
+detail
+detailing
+did
+die
+directly
+dirt
+disappear
+disappeared
+dismal
+disposition
+divert
+do
+doing
+done
+donkey
+doom
+down
+draped
+dressed
+drooped
+dull
+dumb
+during
+eager
+ear
+ears
+earth
+earthquake
+easy
+eat
+edelweiss
+either
+elephants
+eleven
+eloquence
+embrace
+encounter
+end
+ended
+enough
+entered
+entirely
+established
+estimate
+even
+evening
+events
+ever
+every
+everybody
+examine
+exceeded
+excellent
+except
+excess
+exclaimed
+excursions
+executed
+exhaustion
+expected
+expedition
+experimenter
+explained
+explosion
+extreme
+eye
+eyes
+face
+faces
+fact
+fagged
+failed
+fainted
+fallen
+false
+far
+fast
+fastened
+faster
+fatal
+father
+fatigue
+fear
+feared
+fearful
+fears
+feature
+feel
+feet
+fell
+fellow
+fetch
+feverishly
+few
+fifteen
+filing
+find
+finer
+firmly
+first
+five
+five-pound
+fixed
+flank
+foot
+for
+forest
+forgotten
+form
+forth
+forty-foot
+forward
+found
+four
+frantic
+free
+frequency
+fresh
+friend
+frightened
+from
+front
+frozen
+full
+furthest
+fury
+gave
+gazing
+general
+gentle
+get
+give
+glad
+glanced
+gliding
+go
+going
+gone
+good
+got
+grace
+grand
+gratifying
+great
+green
+ground
+grow
+growing
+guide
+guides
+guttered
+had
+half
+half-mile
+halt
+hampered
+hand
+hands
+happened
+harder
+hardly
+harris
+hat
+hate
+haunts
+have
+having
+he
+head
+hear
+heard
+heavens
+heavy
+held
+here
+hesitated
+high
+hill
+him
+himself
+his
+hoist
+hold
+homes
+hook
+hook-rope
+hoping
+horns
+host
+hotel
+hotels
+hour
+hours
+how
+hurry
+huts
+huzza
+i
+ice-ax
+ice-axes
+idea
+if
+implement
+implements
+imposing
+impressive
+impulse
+in
+inches
+including
+indignant
+ingratitude
+injured
+innocent
+inquiries?
+inquiring
+#copyin
+#user
+#uncopyin
+tail -1 .copy >X1
+%s/../lcount <text >X2
+#cmp X1 X2
+#log
+#next
+21.1e 6
diff --git a/usr.bin/learn/lib/editor/L21.1e b/usr.bin/learn/lib/editor/L21.1e
new file mode 100644
index 00000000000..14ab446ceef
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L21.1e
@@ -0,0 +1,33 @@
+#print
+This directory contains a file "abot" which
+has an extra line (one line was typed twice).
+Remove the extra line and rewrite the
+file; then type "ready". This file is
+fairly short.
+#create Ref
+seven qualities characterize the clod and seven the
+wise man: the wise man does not speak before him
+that is greater than he in wisdom; he does not
+break into his fellow's speech; he is not in a rush to
+reply; he asks what is relevant and replies to the
+point; he speaks of first things first and of last
+things last; of what he has not heard he says "I
+have not heard"; and he acknowledges what is true.
+ and the opposites apply to the clod.
+#create abot
+seven qualities characterize the clod and seven the
+wise man: the wise man does not speak before him
+that is greater than he in wisdom; he does not
+break into his fellow's speech; he is not in a rush to
+break into his fellow's speech; he is not in a rush to
+reply; he asks what is relevant and replies to the
+point; he speaks of first things first and of last
+things last; of what he has not heard he says "I
+have not heard"; and he acknowledges what is true.
+ and the opposites apply to the clod.
+#user
+#cmp abot Ref
+#log
+#next
+30.1a 10
+30.2a 5
diff --git a/usr.bin/learn/lib/editor/L3.1a b/usr.bin/learn/lib/editor/L3.1a
new file mode 100644
index 00000000000..2c8ea3d5d4e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L3.1a
@@ -0,0 +1,21 @@
+#print
+The editor accepts commands one per line,
+just like the other programs in UNIX; but its
+commands are unique to it. The
+only command present in every editing session is the
+last one, 'q' (quit) which returns to the normal
+command interpreting program. I'm going to put
+you in the editor. Type 'q' to leave,
+and then type "ready" when you get the '$' from
+the normal command handler.
+#create junk
+You're in the editor.
+#pipe
+ed - junk
+1p
+#user
+#unpipe
+#cmp junk junk
+#log
+#next
+3.1b 5
diff --git a/usr.bin/learn/lib/editor/L3.1b b/usr.bin/learn/lib/editor/L3.1b
new file mode 100644
index 00000000000..3b1e9b80097
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L3.1b
@@ -0,0 +1,37 @@
+#print
+A particularly important editor command
+is 'w' (write). This writes whatever
+you are working on, including everything you
+have typed in or changed, into a file,
+so that you can work on it again later.
+If you try to quit from the editor without
+writing out your changes, the editor will complain
+(but only once -- a second 'q' will let you out).
+Generally it's wisest to leave the editor by typing
+
+w
+q
+
+rather than just 'q'. I'll put you in the editor;
+type those two commands to leave. Then type
+"ready".
+#create bpres
+Washington Adams Jefferson
+#create pres
+Washington Adams Jefferson
+#pipe
+ed pres
+#user
+#unpipe
+#cmp pres bpres
+#succeed
+Note that the editor typed 27. This is the number
+of characters it wrote into the file. This
+is reassuring - it tells you the write was
+successful. The count of characters read
+is also typed, which is why you got a '27'
+before your responses.
+#log
+#next
+4.1a 10
+4.2a 5
diff --git a/usr.bin/learn/lib/editor/L30.1a b/usr.bin/learn/lib/editor/L30.1a
new file mode 100644
index 00000000000..d0427376d53
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.1a
@@ -0,0 +1,27 @@
+#print
+Although it is always possible to fix errors by retyping
+the entire erroneous line with the 'c' command, it is
+usually much faster to make small changes within
+a line. The editor allows this with the 's' (substitute)
+command. For example,
+ s/abc/def/
+will change a line previously reading
+ xxx abc
+into one reading
+ xxx def
+by replacing the string 'abc' in the line with the string 'def'.
+In this directory is a file 'pres' with one line that says
+'harry' where it should say 'george'. Fix it using the
+substitute command to change 'harry' into 'george'. You
+should use the 'p' command to print the line before and
+after, checking that you did it correctly. Then
+rewrite the file and type 'ready'.
+#create Ref
+george washington
+#create pres
+harry washington
+#user
+#cmp Ref pres
+#log
+#next
+30.1b 10
diff --git a/usr.bin/learn/lib/editor/L30.1b b/usr.bin/learn/lib/editor/L30.1b
new file mode 100644
index 00000000000..65d65c4d6f1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.1b
@@ -0,0 +1,27 @@
+#print
+As with other commands, you can specify a line
+number in front of the 's' command. Thus
+ 3s/x/a/
+will change the first 'x' to an 'a' on the third line
+of the current file. Pick up file 'town' and
+change the 'q' on the last line to a 'p'. Then
+rewrite the file and type 'ready'.
+#create Ref
+south orange
+maplewood
+millburn
+short hills
+summit
+new providence
+#create town
+south orange
+maplewood
+millburn
+short hills
+summit
+new qrovidence
+#user
+#cmp town Ref
+#log
+#next
+31.1a 10
diff --git a/usr.bin/learn/lib/editor/L30.2a b/usr.bin/learn/lib/editor/L30.2a
new file mode 100644
index 00000000000..6bccfcb92a8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2a
@@ -0,0 +1,30 @@
+#print
+Changing a whole line with the 'c' command is a slow way
+to work when you only want to change a few letters. The 's' (substitute)
+command changes the letters within a line. For example, the command
+ s/abc/def/
+will change a line reading
+ xxxabc
+into one reading
+ xxxdef
+by replacing the string 'abc' with 'def'. Try the following sequence which
+alters the first line of the file 'test' within this directory:
+
+ed test
+1p
+s/months/years/
+1p
+w
+q
+ready
+#create Ref
+Four score and seven years ago our
+fathers brought forth ...
+#create test
+Four score and seven months ago our
+fathers brought forth ...
+#user
+#cmp test Ref
+#log
+#next
+30.2b 5
diff --git a/usr.bin/learn/lib/editor/L30.2b b/usr.bin/learn/lib/editor/L30.2b
new file mode 100644
index 00000000000..bf4edd6a89b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2b
@@ -0,0 +1,17 @@
+#print
+In this directory is a file 'pres' whose first line says
+'harry' where it should say 'george'. Fix it using the
+substitute command to change 'harry' into 'george'. You should
+use the 'p' command to print the line before and after, checking
+that the change took place. Then rewrite the file and
+type 'ready'.
+#create Ref
+george washington
+#create pres
+harry washington
+#user
+#cmp pres Ref
+#log
+#next
+30.1b 10
+30.2c 5
diff --git a/usr.bin/learn/lib/editor/L30.2c b/usr.bin/learn/lib/editor/L30.2c
new file mode 100644
index 00000000000..1a5665031d1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2c
@@ -0,0 +1,34 @@
+#print
+As with other commands, you can specify a line number
+with the 's' command. Thus
+ 3s/x/a/
+will change the first 'x' on line 3 to an 'a'. Here is
+a file "street" in which the fifth line has an 'r'
+where it should have an 'a'. Try
+the sequence
+
+ed street
+5s/r/a/
+5p
+w
+q
+ready
+#create Ref
+first avenue
+second avenue
+third avenue
+lexington avenue
+park avenue
+madison avenue
+#create street
+first avenue
+second avenue
+third avenue
+lexington avenue
+prrk avenue
+madison avenue
+#user
+#cmp street Ref
+#log
+#next
+30.2d 5
diff --git a/usr.bin/learn/lib/editor/L30.2d b/usr.bin/learn/lib/editor/L30.2d
new file mode 100644
index 00000000000..1deb0b784e1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2d
@@ -0,0 +1,18 @@
+#print
+In this directory is a file named "airport"
+whose second line says "xx" where it should say
+"ne". Edit the file, change those letters, and
+rewrite the file. Then type "ready".
+#create Ref
+idlewild
+newark
+laguardia
+#create airport
+idlewild
+xxwark
+laguardia
+#user
+#cmp airport Ref
+#log
+#next
+30.2e 5
diff --git a/usr.bin/learn/lib/editor/L30.2e b/usr.bin/learn/lib/editor/L30.2e
new file mode 100644
index 00000000000..7635883cdd3
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2e
@@ -0,0 +1,24 @@
+#print
+Now edit the file named "town" and change
+the 'q' on the last line to a 'p'. Rewrite the
+corrected file and type 'ready'.
+#create Ref
+south orange
+maplewood
+millburn
+short hills
+summit
+new providence
+#create town
+south orange
+maplewood
+millburn
+short hills
+summit
+new qrovidence
+#user
+#cmp town Ref
+#log
+#next
+30.2f 5
+31.1a 10
diff --git a/usr.bin/learn/lib/editor/L30.2f b/usr.bin/learn/lib/editor/L30.2f
new file mode 100644
index 00000000000..20b2e507d6e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2f
@@ -0,0 +1,22 @@
+#print
+Now there is a file named "equipment"
+and on the next to last line is a word
+that contains 'nn' where it should have 'mm'.
+Fix it and rewrite the file. Then type "ready".
+#create Ref
+screwdriver
+wrench
+saw
+hammer
+pliers
+#create equipment
+screwdriver
+wrench
+saw
+hanner
+pliers
+#user
+#cmp equipment Ref
+#log
+#next
+30.2g 5
diff --git a/usr.bin/learn/lib/editor/L30.2g b/usr.bin/learn/lib/editor/L30.2g
new file mode 100644
index 00000000000..a32db4fc379
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2g
@@ -0,0 +1,24 @@
+#print
+This directory contains a file named "markets" which
+has a 'q' on the last line where it should have a 'p'.
+Rewrite the corrected version on a new file named
+"nmark". Then type "ready".
+#create Ref
+shop-rite
+acme
+kings
+a&p
+finast
+pathmark
+#create markets
+shop-rite
+acme
+kings
+a&p
+finast
+qathmark
+#user
+#cmp nmark Ref
+#log
+#next
+30.2h 5
diff --git a/usr.bin/learn/lib/editor/L30.2h b/usr.bin/learn/lib/editor/L30.2h
new file mode 100644
index 00000000000..5be2c4c1e1b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L30.2h
@@ -0,0 +1,27 @@
+#print
+The two files you were editing are still around here.
+Use "diff" to see what the differences between them are
+and check that the correction was made properly. Then
+type "ready".
+#create markets
+shop-rite
+acme
+kings
+a&p
+finast
+qathmark
+#create nmark
+shop-rite
+acme
+kings
+a&p
+finast
+pathmark
+#copyin
+#user
+#uncopyin
+#match diff markets nmark
+#match diff nmark markets
+#log
+#next
+31.1a 10
diff --git a/usr.bin/learn/lib/editor/L31.1a b/usr.bin/learn/lib/editor/L31.1a
new file mode 100644
index 00000000000..10175ca2b58
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L31.1a
@@ -0,0 +1,38 @@
+#print
+I hope you have been checking the effects of your
+substitutions by using the 'p' command before and
+after the changes. This is so often desired that
+you may type the 'p' on the same line, after the 's'
+command. Thus
+ s/ab/cd/p
+changes 'ab' to 'cd' and prints the line after the change.
+In this directory there is a file named 'tree'. Try changing
+the fourth line, which now reads
+ spruxx
+to read
+ spruce
+and then rewrite the file, and type 'ready'.
+#create Ref
+pine
+fir
+hemlock
+spruce
+birch
+beech
+hickory
+maple
+#create tree
+pine
+fir
+hemlock
+spruxx
+birch
+beech
+hickory
+maple
+#user
+#cmp Ref tree
+#log
+#next
+32.1a 10
+31.2b 5
diff --git a/usr.bin/learn/lib/editor/L31.2b b/usr.bin/learn/lib/editor/L31.2b
new file mode 100644
index 00000000000..264802a725f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L31.2b
@@ -0,0 +1,25 @@
+#print
+This directory contains a file "animal" which has
+a mistyped line. Print the file, find the line,
+fix the error using the 's' command, and then
+rewrite the corrected file and type "ready".
+#create Ref
+cat
+dog
+raccoon
+groundhog
+mouse
+mole
+#create animal
+cat
+dog
+rakkoon
+groundhog
+mouse
+mole
+#user
+#cmp animal Ref
+#log
+#next
+32.1a 10
+31.2c 5
diff --git a/usr.bin/learn/lib/editor/L31.2c b/usr.bin/learn/lib/editor/L31.2c
new file mode 100644
index 00000000000..4afa2dcb3ba
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L31.2c
@@ -0,0 +1,32 @@
+#print
+In this directory there is a file "checks"
+which contains 3 errors. Fix the spelling errors
+and rewrite the file. Then type "ready".
+#create Ref
+ The establishment of credit all over the civilized world made it
+possible to develop new inventions, enlarge factories, produce more
+goods so that more people could earn wages to buy them. Soon even
+the supply of paper money would have been too small to take care of
+the needs of business, had it not been for a new form of money. This
+was the "check-book dollar."
+ There are now from 25 to 30 billion dollars in paper money
+circulating in the United States. But that is only one tenth of
+what is needed to do business every year. The other 90 per cent is
+in the form of check-book dollars.
+#create checks
+ The establishment of credit all over the civilized world made it
+possible to develop new inventions, enlarge factories, produce more
+goods so that more people could earn wages to buy them. Soon even
+the supply of paper money would have been too smalp to take care of
+the needs of businees, had it not been for a new form of money. This
+was the "check-book dollar."
+ There are now from 25 to 30 billion dollars in paper money
+circulating in txe United States. But that is only one tenth of
+what is needed to do business every year. The other 90 per cent is
+in the form of check-book dollars.
+#user
+#cmp checks Ref
+#log
+#next
+32.1a 10
+32.2a 5
diff --git a/usr.bin/learn/lib/editor/L32.1a b/usr.bin/learn/lib/editor/L32.1a
new file mode 100644
index 00000000000..2e69407abab
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.1a
@@ -0,0 +1,29 @@
+#print
+Just as you can specify files with an abbreviation,
+it is also possible, in the 's' command, to
+use an abbreviation for the string to be used
+for substitution. Unfortunately, the characters
+used to indicate an abbreviation are quite
+different, and you must learn them separately for the
+editor and the file-name interpreter. (Sorry about
+that, but that's the way the world is.)
+
+The symbol for 'any character' is '.'. Thus
+ s/a./bc/p
+looks for an 'a' followed by anything, and changes those
+characters into 'bc'.
+Thus the line
+ what now
+would become
+ whbc now
+after that command.
+What will the word "floating" become after
+ s/a./or/
+is executed? Type "answer WORD" where WORD is the new version.
+#copyin
+#user
+#uncopyin
+#match flooring
+#log
+#next
+32.1b 10
diff --git a/usr.bin/learn/lib/editor/L32.1b b/usr.bin/learn/lib/editor/L32.1b
new file mode 100644
index 00000000000..90067e729e5
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.1b
@@ -0,0 +1,18 @@
+#print
+Note that the substitute command changes the first
+instance of something that matches. Consider the
+line
+ now is the time for all good men
+and the substitute command
+ s/tim/TIM/
+applied to it.
+Which word in the line will be altered by that command?
+Type "answer WORD" where WORD is the word that will
+be changed.
+#copyin
+#user
+#uncopyin
+#match time
+#log
+#next
+32.1c 10
diff --git a/usr.bin/learn/lib/editor/L32.1c b/usr.bin/learn/lib/editor/L32.1c
new file mode 100644
index 00000000000..8bf4dc579d8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.1c
@@ -0,0 +1,16 @@
+#print
+Now, with the line
+ now is the time for all good men
+and the command
+ s/t../TIM/p
+what word will be changed? Again, type
+"answer WORD"; remember that "." matches
+any character, and the first match is picked.
+#copyin
+#user
+#uncopyin
+#match the
+#log
+#next
+33.1a 10
+33.2a 5
diff --git a/usr.bin/learn/lib/editor/L32.2a b/usr.bin/learn/lib/editor/L32.2a
new file mode 100644
index 00000000000..73496b8a0bf
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2a
@@ -0,0 +1,32 @@
+#print
+Just as you can use abbreviations to specify a class of
+filenames, you can use abbreviationss in the editor to recognize
+strings in the substitute command. Unfortunately, the
+characters used in the editor are quite different from the
+ones used in the file-name handler to specify patterns.
+(Sorry about that, but that's the way the world is.)
+
+The symbol for 'any character' is '.' and this will
+match any single letter or other character in a line.
+For example,
+ s/a./bc/
+looks for an 'a' followed by anything, and changes those
+two letters into 'bc'. Try this sequence and note
+what happens.
+
+ed line
+p
+s/a./bc/p
+w
+q
+ready
+#create Ref
+me bcd you
+#create line
+me and you
+#user
+#cmp line Ref
+#log
+#next
+32.2b 5
+32.2c 10
diff --git a/usr.bin/learn/lib/editor/L32.2b b/usr.bin/learn/lib/editor/L32.2b
new file mode 100644
index 00000000000..69d61cfd564
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2b
@@ -0,0 +1,14 @@
+#print
+Or, to take another example, the command
+ s/h./ar/
+would turn the word "that" into "tart": the '.' matches
+the 'a'. What would that command change the
+word "what" into? Reply "answer WORD" where WORD
+is what the substitute command would produce.
+#copyin
+#user
+#uncopyin
+#match wart
+#log
+#next
+32.2c 5
diff --git a/usr.bin/learn/lib/editor/L32.2c b/usr.bin/learn/lib/editor/L32.2c
new file mode 100644
index 00000000000..fd9526511b4
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2c
@@ -0,0 +1,14 @@
+#print
+What will the word "floating" become after
+the command
+ s/a./or/
+is executed? Type "answer WORD" where WORD is the
+new version.
+#copyin
+#user
+#uncopyin
+#match flooring
+#log
+#next
+32.2d 5
+32.1b 10
diff --git a/usr.bin/learn/lib/editor/L32.2d b/usr.bin/learn/lib/editor/L32.2d
new file mode 100644
index 00000000000..f0c25984dd6
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2d
@@ -0,0 +1,11 @@
+#print
+Is the word "stop" changed by the command
+ s/to/xx/p
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+32.2e 5
diff --git a/usr.bin/learn/lib/editor/L32.2e b/usr.bin/learn/lib/editor/L32.2e
new file mode 100644
index 00000000000..72bb0287389
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2e
@@ -0,0 +1,12 @@
+#print
+Is the word "stop" changed by the command
+ s/tp/xx/p
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match no
+#log
+#next
+32.2f 5
+32.1b 10
diff --git a/usr.bin/learn/lib/editor/L32.2f b/usr.bin/learn/lib/editor/L32.2f
new file mode 100644
index 00000000000..5182018ccb8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2f
@@ -0,0 +1,11 @@
+#print
+Is the word "stop" changed by the command
+ s/t./xx/p
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+32.2g 5
diff --git a/usr.bin/learn/lib/editor/L32.2g b/usr.bin/learn/lib/editor/L32.2g
new file mode 100644
index 00000000000..b31012c1bfb
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L32.2g
@@ -0,0 +1,26 @@
+#print
+One place where "." is useful is in changing
+letters that are hard to type, e.g. the # and @
+characters. For example, the command
+ s/a.b/xxx/
+will change "a#b" to "xxx". There is a file named
+"goof" in this directory whose third line contains
+the word
+ sp#xll
+which should be "spell". Change it and rewrite the file;
+then type "ready".
+#create Ref
+whoever typed this
+either couldn't type
+or couldn't spell
+properly.
+#create goof
+whoever typed this
+either couldn't type
+or couldn't sp#xll
+properly.
+#user
+#cmp goof Ref
+#log
+#next
+32.1b 5
diff --git a/usr.bin/learn/lib/editor/L33.1a b/usr.bin/learn/lib/editor/L33.1a
new file mode 100644
index 00000000000..6b9a32aa77b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L33.1a
@@ -0,0 +1,20 @@
+#print
+When you want to match one of a few specific characters, and not
+just any character, the pattern is similar to the pattern used
+in filenames. The patterns used with the editor, by
+the way, are called "regular expressions". The string
+ [abc]
+matches 'a', 'b' or 'c'. So if the current line
+is
+ now is the time for all good men
+and the command is
+ s/t[ijk]/xx/
+what word is changed? Type "answer WORD" where WORD is the
+word changed by that command.
+#copyin
+#user
+#uncopyin
+#match time
+#log
+#next
+33.1b 10
diff --git a/usr.bin/learn/lib/editor/L33.1b b/usr.bin/learn/lib/editor/L33.1b
new file mode 100644
index 00000000000..83572235b8b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L33.1b
@@ -0,0 +1,24 @@
+#print
+Write the command that will change
+either the word "that" or the word "than"
+into "this", and then print the result. Type
+"answer COMMAND" on a line, where COMMAND is
+that string. (That is, COMMAND
+will be of the form
+ s/.../.../p
+where you have replaced the ... with the right stuff.)
+You can test this out by going into the editor and
+typing in a line that contains "that" and "than"
+and trying to change it. You should do that until you
+are sure you have the command right.
+#copyin
+#user
+#uncopyin
+#match s/tha[nt]/this/p
+#match s/tha[tn]/this/p
+#match s/tha[nt]/this/gp
+#match s/tha[tn]/this/gp
+#log
+#next
+34.1a 10
+34.2a 5
diff --git a/usr.bin/learn/lib/editor/L33.2a b/usr.bin/learn/lib/editor/L33.2a
new file mode 100644
index 00000000000..ab451ec74bf
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L33.2a
@@ -0,0 +1,27 @@
+#print
+When you want to match one of a few specific characters,
+and not anything, the pattern is similar to that used in
+file names. That is,
+ [abc]
+matches the letters 'a', 'b', or 'c', but nothing
+else. Try this sequence and note what happens:
+
+ed lines
+1,$p
+1s/[123]/9/
+2s/[123]/9/
+1,$p
+w
+q
+ready
+#create Ref
+599
+948
+#create lines
+519
+348
+#user
+#cmp lines Ref
+#log
+#next
+33.2b 5
diff --git a/usr.bin/learn/lib/editor/L33.2b b/usr.bin/learn/lib/editor/L33.2b
new file mode 100644
index 00000000000..260823553d7
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L33.2b
@@ -0,0 +1,26 @@
+#print
+You can of course use the [] operators anywhere in
+a pattern. Editor patterns, by the way, are called
+"regular expressions". For example, suppose you wanted
+to change either the word "trick" or the word "track"
+to "stop". What command would you need?
+Do you see that
+
+ s/tr[ia]ck/stop/p
+
+will do that? Now figure out what command you would
+need to change either "bear" or "beat" into "best"
+and print the line after the change.
+Type "answer COMMAND" where COMMAND is that line.
+#copyin
+#user
+#uncopyin
+#match s/bea[rt]/best/p
+#match s/bea[tr]/best/p
+#match s/bea[rt]/best/
+You forgot the "p" part.
+#match s/bea[tr]/best/
+You forgot the "p" part.
+#log
+#next
+33.2c 5
diff --git a/usr.bin/learn/lib/editor/L33.2c b/usr.bin/learn/lib/editor/L33.2c
new file mode 100644
index 00000000000..f0bc9e07d32
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L33.2c
@@ -0,0 +1,19 @@
+#print
+Suppose the current line is
+
+now is the time for all good men
+
+and you type the substitute command
+
+s/t[ijk]/xx/
+
+what word is changed? Type "answer WORD" where
+WORD is the word changed in the line.
+#copyin
+#user
+#uncopyin
+#match time
+#log
+#next
+34.1a 10
+33.1b 5
diff --git a/usr.bin/learn/lib/editor/L34.1a b/usr.bin/learn/lib/editor/L34.1a
new file mode 100644
index 00000000000..2fd76d9387e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.1a
@@ -0,0 +1,17 @@
+#print
+You can also specify "all characters except ..."
+using an expression of the form
+ [^ab]
+which means "anything except an 'a' or 'b' character".
+Will
+ s/ab[^cde]/xyz23/p
+change
+ xbcabfgh
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+34.1b 10
diff --git a/usr.bin/learn/lib/editor/L34.1b b/usr.bin/learn/lib/editor/L34.1b
new file mode 100644
index 00000000000..925143febd9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.1b
@@ -0,0 +1,19 @@
+#print
+Will the command
+ s/ab[^cde]/xx/p
+change the line
+ abcxyzabfxyz
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#fail
+Remember that the s/.../../ command will
+keep looking through the line for something
+to change, even if the beginning of the
+line doesn't match.
+#log
+#next
+35.1a 10
+35.2a 5
diff --git a/usr.bin/learn/lib/editor/L34.2a b/usr.bin/learn/lib/editor/L34.2a
new file mode 100644
index 00000000000..b0b7b0236b2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2a
@@ -0,0 +1,15 @@
+#print
+You can also specify "all characters except ..."
+using an expression of the form
+ [^ab]
+which means "any character except the letters 'a' or 'b'.
+This is just like filename patterns again. Does
+ [^abc]
+match the letter 'a'? Answer "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match no
+#log
+#next
+34.2b 5
diff --git a/usr.bin/learn/lib/editor/L34.2b b/usr.bin/learn/lib/editor/L34.2b
new file mode 100644
index 00000000000..f143e0213a8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2b
@@ -0,0 +1,11 @@
+#print
+Does
+ [^abc]
+match the letter 'd'? Answer "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+34.2c 5
diff --git a/usr.bin/learn/lib/editor/L34.2c b/usr.bin/learn/lib/editor/L34.2c
new file mode 100644
index 00000000000..e4c6506f818
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2c
@@ -0,0 +1,9 @@
+#print
+Does [abc] match 'a'? Answer "yes" or "no"?
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+34.2d 5
diff --git a/usr.bin/learn/lib/editor/L34.2d b/usr.bin/learn/lib/editor/L34.2d
new file mode 100644
index 00000000000..133ddb9e42b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2d
@@ -0,0 +1,10 @@
+#print
+Does [^abc] match the '*' character?
+Type "yes" or "no".
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+34.2e 5
diff --git a/usr.bin/learn/lib/editor/L34.2e b/usr.bin/learn/lib/editor/L34.2e
new file mode 100644
index 00000000000..681a3c6ea82
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2e
@@ -0,0 +1,22 @@
+#print
+Suppose you wanted to match all letters and
+punctuation marks. You could try
+ [^ ]
+which is "anything but blank".
+Try the following commands:
+
+ed cut
+1p
+1s/p[^ ]/xxx/p
+w
+q
+ready
+#create Ref
+stop this comxxxter
+#create cut
+stop this computer
+#user
+#cmp cut Ref
+#log
+#next
+34.2f 5
diff --git a/usr.bin/learn/lib/editor/L34.2f b/usr.bin/learn/lib/editor/L34.2f
new file mode 100644
index 00000000000..0dfcca39cbe
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L34.2f
@@ -0,0 +1,14 @@
+#print
+Will
+ s/ab[^cde]/xyz23/p
+change
+ xbcabfgh
+Type "yes" or "no". (Try it out
+first in the editor if you don't know.)
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+34.1b 10
diff --git a/usr.bin/learn/lib/editor/L35.1a b/usr.bin/learn/lib/editor/L35.1a
new file mode 100644
index 00000000000..6ef8b47e403
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.1a
@@ -0,0 +1,39 @@
+#print
+The "*" character is also used in substitute commands,
+but it has a different meaning. Here it means
+"any number of repetitions of the previous character".
+(including zero!). Thus
+ a*
+is any number of 'a' characters, and
+ [ab]*
+is any number of either 'a' or 'b' characters.
+So
+ s/ab*/xy/
+looks for an 'a' followed by any number of 'b'
+letters, and will change
+ abbb cde
+into
+ xy cde
+You can use '*' after anything, including for example
+blank. Thus
+ s/a */a/
+removes all the blanks after the letter 'a'. In this
+directory there is a file 'text'. On the third line,
+remove the blanks after the word 'the'. Then rewrite the
+file and type "ready".
+#create Ref
+This is the file
+for experimentation
+with the(substitute)
+command.
+#create text
+This is the file
+for experimentation
+with the (substitute)
+command.
+#user
+#cmp text Ref
+#log
+#next
+36.1a 10
+36.2a 5
diff --git a/usr.bin/learn/lib/editor/L35.2a b/usr.bin/learn/lib/editor/L35.2a
new file mode 100644
index 00000000000..474472c4a2a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.2a
@@ -0,0 +1,31 @@
+#print
+The '*' character is also used in the editor patterns (the regular
+expressions) but it has quite a different meaning from '*'
+as used in filenames. In the editor it means "any
+number of repetitions of the previous character." Thus
+ a*
+might match "a" or "aa" or "aaa" or "aaaa" and so on.
+It might also match nothing, because "any number
+of repetitions" includes "zero"! Perhaps it
+will be clearer after you do the following example.
+Note what happens to the two lines. Type
+
+ed file
+1,2p
+1s/xa*/xy/
+2s/xa*/xy/
+1,2p
+w
+q
+ready
+#create Ref
+abxy
+abxycd
+#create file
+abxaaa
+abxcd
+#user
+#cmp file Ref
+#log
+#next
+35.2b 5
diff --git a/usr.bin/learn/lib/editor/L35.2b b/usr.bin/learn/lib/editor/L35.2b
new file mode 100644
index 00000000000..91cc213f88f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.2b
@@ -0,0 +1,23 @@
+#print
+Now suppose we wanted to delete the blanks
+after the letter "t" in this line:
+
+here are a lot of blanks
+
+This line is on file "blank". Try the sequence
+
+ed blank
+1p
+s/t */t/p
+w
+q
+ready
+#create Ref
+here are a lotof blanks
+#create blank
+here are a lot of blanks
+#user
+#cmp blank Ref
+#log
+#next
+35.2c 5
diff --git a/usr.bin/learn/lib/editor/L35.2c b/usr.bin/learn/lib/editor/L35.2c
new file mode 100644
index 00000000000..cbf4e9d320a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.2c
@@ -0,0 +1,22 @@
+#print
+You can use '*' to look for a string of characters
+from one of the character classes. Suppose, for example,
+we wanted a long string of either 'a' or 'b', followed
+by 'x'. Then we could write
+
+ s/[ab]*x/.../
+
+In this directory is a file named "table".
+It has only one line. On that line, replace all the digits
+followed by a comma with the letters "too big". For example,
+"123,000" should become "too big,000".
+Then rewrite the file and type "readY".
+#create Ref
+Heathrow too big,159
+#create table
+Heathrow 17073,159
+#user
+#cmp table Ref
+#log
+#next
+35.2d 5
diff --git a/usr.bin/learn/lib/editor/L35.2d b/usr.bin/learn/lib/editor/L35.2d
new file mode 100644
index 00000000000..d92b66952c1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.2d
@@ -0,0 +1,25 @@
+#print
+A useful operation is to replace a string of several blanks
+by exactly one blank. Note that you can't just write
+
+s/ */ /
+
+because the " *" willl match any number of blanks
+including zero. Thus it will always match at the beginning
+of the line, even if there is no blank there.
+The normal sequence is
+
+s/ */ /
+which will only substitute for a string
+that has at least one blank in it.
+Try that command on the line in the file "line".
+Then rewrite the file "line" and type "ready".
+#create Ref
+here is a long space.
+#create line
+here is a long space.
+#user
+#cmp line Ref
+#log
+#next
+35.2e 5
diff --git a/usr.bin/learn/lib/editor/L35.2e b/usr.bin/learn/lib/editor/L35.2e
new file mode 100644
index 00000000000..cd3a6a0f776
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L35.2e
@@ -0,0 +1,33 @@
+#print
+A very powerful construction is ".*",
+which matches any character (remember '.')
+repeated any number of times. For example
+
+s/a.*b/.../
+
+replaces anything of the forms
+
+axyzb, aaaaaab, a1234b, abbbb
+
+since it requires just an 'a' and a 'b'
+at the ends of the string, with
+anything at all in between.
+Or, to throw away everything
+on a line after the word "stop", you could try
+
+s/stop.*/stop/
+
+In this directory is a file "sentence".
+Delete everything after
+the word "last" on the second line of the file.
+#create Ref
+This file has a sentence in which
+this is the last
+#create sentence
+This file has a sentence in which
+this is the last word which should be left.
+#user
+#cmp sentence Ref
+#next
+36.1a 10
+36.2a 5
diff --git a/usr.bin/learn/lib/editor/L36.1a b/usr.bin/learn/lib/editor/L36.1a
new file mode 100644
index 00000000000..d0196c6b6c2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L36.1a
@@ -0,0 +1,33 @@
+#print
+So far all the special characters in the substitute command
+have been used in the left-hand expression, the one that
+is looked for in the line as it exists before the change.
+None of these characters are meaningful in the right-hand
+expression; for example,
+ s/ab/a./
+turn "ab" into "a." just as if "." were an ordinary letter.
+But there is one character that is special on the right
+side of a substitution, which is '&'. The ampersand
+is replaced by whatever text is being replaced. In
+ s/the/&m/
+the string "the" is turned into "them" because the '&' is
+replaced by "the".
+In this directory there is a file 'text'; on the third line,
+change the word 'dog' into 'dogs'; then rewrite the file
+and say "ready".
+#create Ref
+cat
+mouse
+dogs
+rat
+#create text
+cat
+mouse
+dog
+rat
+#user
+#cmp text Ref
+#log
+#next
+37.1a 10
+37.2a 6
diff --git a/usr.bin/learn/lib/editor/L36.2a b/usr.bin/learn/lib/editor/L36.2a
new file mode 100644
index 00000000000..83801f0c753
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L36.2a
@@ -0,0 +1,21 @@
+#print
+So far all the special characters in the substitute
+command are used to select the string to be replaced.
+There is one character used in the new string to be inserted.
+It is '&' which when used on the right hand side of a substitution,
+refers to the expression given on the left hand side.
+For example, the command
+
+s/the/&m/
+
+changes "the" into "them". Try that on file "text";
+then rewrite the file and type "ready".
+#create Ref
+we went to see them yesterday.
+#create text
+we went to see the yesterday.
+#user
+#cmp text Ref
+#log
+#next
+36.2b 5
diff --git a/usr.bin/learn/lib/editor/L36.2b b/usr.bin/learn/lib/editor/L36.2b
new file mode 100644
index 00000000000..a9e29309c28
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L36.2b
@@ -0,0 +1,18 @@
+#print
+Now, in file 'pets', change the word 'dog' on the third line
+into 'dogs'. Then rewrite the file and type "ready".
+#create Ref
+cats
+hamsters
+dogs
+gerbils
+#create pets
+cats
+hamsters
+dog
+gerbils
+#user
+#cmp pets Ref
+#log
+#next
+36.2c 5
diff --git a/usr.bin/learn/lib/editor/L36.2c b/usr.bin/learn/lib/editor/L36.2c
new file mode 100644
index 00000000000..ac057700f58
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L36.2c
@@ -0,0 +1,47 @@
+#print
+On the right side of a substitute, none of the other
+special characters mean anything unusual. Thus, if you wanted to
+replace the letter 'a' by an asterisk, for example, the obvious
+com and would work:
+
+s/a/*/p
+
+Try, in the file "data", replacing the comma on the last line
+with a period. Then rewrite the file and type "ready".
+#create Ref
+ Square Roots
+1.00 1.00
+2.00 1.42
+3.00 1.73
+4.00 2.00
+You really shouldn't be
+printing all of this file -
+did you forget that '$' is
+the address of the last
+line of a file?
+Use that instead of printing everything.
+5.00 2.23
+6.00 2.45
+7.00 2.65
+8.00 2.83
+#create data
+ Square Roots
+1.00 1.00
+2.00 1.42
+3.00 1.73
+4.00 2.00
+You really shouldn't be
+printing all of this file -
+did you forget that '$' is
+the address of the last
+line of a file?
+Use that instead of printing everything.
+5.00 2.23
+6.00 2.45
+7.00 2.65
+8.00 2,83
+#user
+#cmp data Ref
+#log
+#next
+36.2d 5
diff --git a/usr.bin/learn/lib/editor/L36.2d b/usr.bin/learn/lib/editor/L36.2d
new file mode 100644
index 00000000000..c236185a318
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L36.2d
@@ -0,0 +1,21 @@
+#print
+On line 4 of the file "attribute" is either the word
+"color" or the word "Color". With one command
+add an 's' to the end of the word. Check that you did it right;
+then rewrite the file and type "ready".
+#create Ref
+size weight mass
+density shade hue
+quality age price
+lifetime Colors durability
+#create attribute
+size weight mass
+density shade hue
+quality age price
+lifetime Color durability
+#user
+#cmp attribute Ref
+#log
+#next
+37.1a 10
+37.2a 6
diff --git a/usr.bin/learn/lib/editor/L37.1a b/usr.bin/learn/lib/editor/L37.1a
new file mode 100644
index 00000000000..da094dbde2f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.1a
@@ -0,0 +1,27 @@
+#print
+You can use a range of line numbers with the
+substitute command to change more than one line at once.
+For example,
+ 1,5s/dog/&s/
+will change "dog" on each of the first five lines of the
+file into "dogs". Edit file "text" and change the word
+"cat" on every line into "mouse".
+Then rewrite the file and type "ready".
+#create Ref
+domestic mouse
+alley mouse
+persian mouse
+angora mouse
+wildmouse
+#create text
+domestic cat
+alley cat
+persian cat
+angora cat
+wildcat
+#user
+#cmp text Ref
+#log
+#next
+38.1a 10
+38.2a 6
diff --git a/usr.bin/learn/lib/editor/L37.2a b/usr.bin/learn/lib/editor/L37.2a
new file mode 100644
index 00000000000..5fac5825d61
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2a
@@ -0,0 +1,30 @@
+#print
+A range of line numbers can be used with the substitute
+command as with the print command. For example,
+
+$-4,$s/cat/&s/p
+
+will change "cat" into "cats" on the last five lines of
+a file. In this directory there is a file "cliche"
+containing a number of instances of the word "dog"; change
+the instances of "dog" in the first five lines to "dogs".
+Then rewrite the file and type "ready".
+#create Ref
+dogs tired
+sick as a dogs
+dogs eared
+wouldn't send a dogs out on a night like this
+every dogs has his day
+dog gone
+#create cliche
+dog tired
+sick as a dog
+dog eared
+wouldn't send a dog out on a night like this
+every dog has his day
+dog gone
+#user
+#cmp cliche Ref
+#log
+#next
+37.2b 5
diff --git a/usr.bin/learn/lib/editor/L37.2b b/usr.bin/learn/lib/editor/L37.2b
new file mode 100644
index 00000000000..5138f4042f0
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2b
@@ -0,0 +1,20 @@
+#print
+Now edit file "text" and change the "cat" on every line
+into "mouse". Then rewrite the file and type "ready".
+#create Ref
+domestic mouse
+alley mouse
+persian mouse
+angora mouse
+wildmouse
+#create text
+domestic cat
+alley cat
+persian cat
+angora cat
+wildcat
+#user
+#cmp text Ref
+#log
+#next
+37.2c 5
diff --git a/usr.bin/learn/lib/editor/L37.2c b/usr.bin/learn/lib/editor/L37.2c
new file mode 100644
index 00000000000..7ac6e2f7fb7
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2c
@@ -0,0 +1,27 @@
+#print
+How would you find a string of digits? Remember
+[1234567890][1234567890]*
+as an expression? In this directory is a file
+"table" which contains some numbers. On every
+line of the file, follow all numbers by the
+character '%'. It should only take one 's' command.
+Then rewrite the file and type "ready".
+#create Ref
+ Budget Outlays
+Salaries 32%
+Equipment 40%
+Rent 13% (incl. utilities)
+Interest 9%
+Misc. 6%
+#create table
+ Budget Outlays
+Salaries 32
+Equipment 40
+Rent 13 (incl. utilities)
+Interest 9
+Misc. 6
+#user
+#cmp table Ref
+#log
+#next
+37.2d 5
diff --git a/usr.bin/learn/lib/editor/L37.2d b/usr.bin/learn/lib/editor/L37.2d
new file mode 100644
index 00000000000..4d882188a9b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2d
@@ -0,0 +1,22 @@
+#print
+There is another file named "table" in this directory.
+Find all numbers and surround them with "*" characters (that
+is, "345" becomes "*345*". Then rewrite the file
+and type "ready".
+#create Ref
+ Income
+Wages *73*
+Interest *20*
+Gambling *5*
+Other *2*
+#create table
+ Income
+Wages 73
+Interest 20
+Gambling 5
+Other 2
+#user
+#cmp table Ref
+#log
+#next
+37.2e 5
diff --git a/usr.bin/learn/lib/editor/L37.2e b/usr.bin/learn/lib/editor/L37.2e
new file mode 100644
index 00000000000..df98a4693e1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2e
@@ -0,0 +1,39 @@
+#print
+Here is something a bit trickier. We want to add
+an extra space after each word "lengthen". However,
+some of the instances of "lengthen" are followed
+by commas or right parentheses and we want the sapace
+after the comma or right parenthesis in that case. That
+is, the desired transformations are:
+ now new
+lengthen xx lengthen xx
+lengthen, xx lengthen, xx
+lengthen) xx lengthen) xx
+lengthen), xx lengthen), xx
+It should only take one substitute command to do this.
+Remember that "*" matches zero or more instances of
+whatever precedes it.
+Try those changes on the first six lines of the file
+"text" in this directory. Then rewrite the file and
+type "ready".
+#create Ref
+To lengthen this is easy,
+whereas to lengthen, rather
+than to shorten, on the previous line
+is hard. (To lengthen) is an
+infinitive. I said to him, (please lengthen), and
+he did so.
+Why not lengthen this word? Notice it is on line 7.
+#create text
+To lengthen this is easy,
+whereas to lengthen, rather
+than to shorten, on the previous line
+is hard. (To lengthen) is an
+infinitive. I said to him, (please lengthen), and
+he did so.
+Why not lengthen this word? Notice it is on line 7.
+#user
+#cmp text Ref
+#log
+#next
+37.2f 5
diff --git a/usr.bin/learn/lib/editor/L37.2f b/usr.bin/learn/lib/editor/L37.2f
new file mode 100644
index 00000000000..96c33afa6e4
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L37.2f
@@ -0,0 +1,23 @@
+#print
+The file "paragraph" in this directory contains
+a number of commas followed by blanks. Please see
+to it that all commas are followed by exactly one blank.
+Then rewrite the file and type "ready".
+#create Ref
+This text, although somewhat
+strained, is not really
+unintelligible. We have, you see
+to get enough commas, like this
+into it to give you some real practice.
+#create paragraph
+This text, although somewhat
+strained, is not really
+unintelligible. We have, you see
+to get enough commas,like this
+into it to give you some real practice.
+#user
+#cmp paragraph Ref
+#log
+#next
+38.1a 10
+38.2a 6
diff --git a/usr.bin/learn/lib/editor/L38.1a b/usr.bin/learn/lib/editor/L38.1a
new file mode 100644
index 00000000000..ffa16c53b03
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L38.1a
@@ -0,0 +1,29 @@
+#print
+Sometimes it is desirable to specify that
+the characters to be changed are at the beginning
+of the line. This uses the '^' character. For example,
+ s/^ab/xy/p
+will change "ab" to "xy" ONLY if "ab" begins the line.
+Remember that
+ s/ab/xy/p
+would just change the first "ab" anywhere in the line.
+In this directory there is a file "text"; whenever the
+letters "cat" begin a line, change them to "mouse; but leave
+other instances of "cat" unaltered. Do this on each line (it only
+takes one command, as you know). Then rewrite the file and
+type "ready".
+#create Ref
+mouse's paw
+alley cat
+mouse has nine lives
+let the cat out of the bag
+#create text
+cat's paw
+alley cat
+cat has nine lives
+let the cat out of the bag
+#user
+#cmp Ref text
+#log
+#next
+39.1a 10
diff --git a/usr.bin/learn/lib/editor/L38.2a b/usr.bin/learn/lib/editor/L38.2a
new file mode 100644
index 00000000000..2f9942a4148
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L38.2a
@@ -0,0 +1,26 @@
+#print
+Sometimes you want to recognize a string of characters
+only if they appear at the beginning of the line.
+The character '^' is used for this purpose. The
+command
+ s/^ab/xy/
+will change "ab" to "xy" only if "ab" begins the line.
+Try the following and watch what it does.
+
+ed file
+1,2p
+1,2s/^ab/xy/
+w
+q
+ready
+#create Ref
+xycd
+ abcd
+#create file
+abcd
+ abcd
+#user
+#cmp file Ref
+#log
+#next
+38.2b 5
diff --git a/usr.bin/learn/lib/editor/L38.2b b/usr.bin/learn/lib/editor/L38.2b
new file mode 100644
index 00000000000..987c21bea64
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L38.2b
@@ -0,0 +1,20 @@
+#print
+In this directory there is a file "text"; whenever the
+letters "cat" begin a line, change them to "mouse"; but
+leave other instances of "cat" unaltered. Do this on each line.
+Then rewrite the file and type "ready".
+#create Ref
+mouse's paw
+alley cat
+mouse has nine lives
+let the cat out of the bag
+#create text
+cat's paw
+alley cat
+cat has nine lives
+let the cat out of the bag
+#user
+#cmp text Ref
+#log
+#next
+39.1a 10
diff --git a/usr.bin/learn/lib/editor/L39.1a b/usr.bin/learn/lib/editor/L39.1a
new file mode 100644
index 00000000000..722f8e7f52a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L39.1a
@@ -0,0 +1,28 @@
+#print
+Using the "^" character, you can easily put things
+at the beginnings of lines. For example
+ s/^/***/
+puts "***" at the beginning of the line. Now edit
+the file "text" and put the symbol '=' at the beginning
+of lines 3 through 5. Then rewrite the file and type "ready".
+#create Ref
+beef
+pork
+=chicken
+=duck
+=turkey
+lamb
+fish
+#create text
+beef
+pork
+chicken
+duck
+turkey
+lamb
+fish
+#user
+#cmp text Ref
+#log
+#next
+40.1a 10
diff --git a/usr.bin/learn/lib/editor/L4.1a b/usr.bin/learn/lib/editor/L4.1a
new file mode 100644
index 00000000000..5ee279f3910
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L4.1a
@@ -0,0 +1,23 @@
+#print
+You must recognize that the commands typed at the
+editor are distinct from the commands typed at the
+normal UNIX command interpreter. In particular,
+neither program knows the commands recognized by the
+other one. So you must always remember when you
+are talking to the normal command interpreter (the
+one that says $ to you) and when you are talking
+to the editor. The commands 'w' and 'q' are recognized
+by the editor. The commands 'ls', 'mv' and so forth
+are not.
+
+Can you expect the editor to recognize the command
+ cat george
+Type yes or no.
+#copyin
+#user
+#uncopyin
+#match no
+#log
+#next
+4.1b 5
+5.1a 10
diff --git a/usr.bin/learn/lib/editor/L4.1b b/usr.bin/learn/lib/editor/L4.1b
new file mode 100644
index 00000000000..a836e2d801a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L4.1b
@@ -0,0 +1,12 @@
+#print
+Can you expect the normal command interpreter (called
+the 'shell') to recognize
+ w
+Type yes or no.
+#copyin
+#user
+#uncopyin
+#match no
+#log
+#next
+5.1a 10
diff --git a/usr.bin/learn/lib/editor/L4.2a b/usr.bin/learn/lib/editor/L4.2a
new file mode 100644
index 00000000000..60598abac58
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L4.2a
@@ -0,0 +1,17 @@
+#print
+The editor and the 'shell' (the normal command
+interpreter) accept different commands. The
+shell (which types '$' at you) understands
+"ls", "mv", "cp", "date" and so forth; the
+editor understands such commands as 'w' or 'q'.
+
+Who knows about "diff"?
+Type "answer shell" or "answer editor".
+#copyin
+#user
+#uncopyin
+#match shell
+#log
+#next
+4.2b 5
+4.1b 10
diff --git a/usr.bin/learn/lib/editor/L4.2b b/usr.bin/learn/lib/editor/L4.2b
new file mode 100644
index 00000000000..8b1e8d75268
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L4.2b
@@ -0,0 +1,11 @@
+#print
+Who will recognize 'w'?
+Type "answer shell" or "answer editor".
+#copyin
+#user
+#uncopyin
+#match editor
+#log
+#next
+4.1b 5
+5.1a 10
diff --git a/usr.bin/learn/lib/editor/L40.1a b/usr.bin/learn/lib/editor/L40.1a
new file mode 100644
index 00000000000..0ed8b0e3ccb
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L40.1a
@@ -0,0 +1,29 @@
+#print
+There is also a special character which indicates
+the end of the line. It is '$'. So that
+ s/ab$/xy/
+changes 'ab' to 'xy' only if 'ab' ended the line.
+In the file 'text' there are some lines which end
+in 'cup'. Change them to end in 'saucer'. Again,
+it only takes one command.
+Then rewrite the file and type 'ready'.
+#create Ref
+3 teaspoons = 1 tablespoon
+16 tablespoons = 1 saucer
+48 teaspoons = 1 saucer
+2 cups = 1 pint
+2 pints = 1 quart
+1/2 pt = 1 saucer
+#create text
+3 teaspoons = 1 tablespoon
+16 tablespoons = 1 saucer
+48 teaspoons = 1 saucer
+2 cups = 1 pint
+2 pints = 1 quart
+1/2 pt = 1 saucer
+#user
+#cmp text Ref
+#log
+#next
+40.1b 5
+40.2b 10
diff --git a/usr.bin/learn/lib/editor/L40.1b b/usr.bin/learn/lib/editor/L40.1b
new file mode 100644
index 00000000000..77cd8c901ca
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L40.1b
@@ -0,0 +1,29 @@
+#print
+You can also use '$' when you
+just want to add something to the end of a line.
+For example,
+ s/$/./
+puts a period at the end of a line, without destroying
+anything in the line. In file 'decl' there should be a
+comma at the end of the third line. Edit this file,
+put in the comma, and rewrite the file. Then type "ready".
+#create Ref
+When in the course of human events, it becomes
+necessary for one people to dissolve the political
+bands which have connected them with another,
+and to assume among the powers of the earth the separate
+and equal station to which the laws
+of Nature and of Nature's God entitle them ...
+#create decl
+When in the course of human events, it becomes
+necessary for one people to dissolve the political
+bands which have connected them with another
+and to assume among the powers of the earth the separate
+and equal station to which the laws
+of Nature and of Nature's God entitle them ...
+#user
+#cmp decl Ref
+#log
+#next
+41.1a 10
+40.2b 9
diff --git a/usr.bin/learn/lib/editor/L40.2b b/usr.bin/learn/lib/editor/L40.2b
new file mode 100644
index 00000000000..b0e36e6d284
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L40.2b
@@ -0,0 +1,27 @@
+#print
+In the file "section" change all lines ending in the characters
+ ",
+to end in
+ ,"
+so that, for example, the line
+ He said "I'll come",
+becomes
+ He said "I'll come,"
+and then rewrite the file and type "ready".
+#create Ref
+This passage contains a few
+quoted "strings,"
+of which some are "in the middle", and some
+"are at the beginning", and some "are at the end,"
+but all end with commas.
+#create section
+This passage contains a few
+quoted "strings",
+of which some are "in the middle", and some
+"are at the beginning", and some "are at the end",
+but all end with commas.
+#user
+#cmp section Ref
+#log
+#next
+40.2c 5
diff --git a/usr.bin/learn/lib/editor/L40.2c b/usr.bin/learn/lib/editor/L40.2c
new file mode 100644
index 00000000000..60bd44b1396
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L40.2c
@@ -0,0 +1,22 @@
+#print
+In the file "mess" delete all blanks at the ends
+of lines. Be prepared to delete several blanks
+if need be (remember the '*' character).
+Then rewrite the file and type "ready".
+#create Ref
+It is possible to use
+a small counter to keep
+approximate counts
+of large numbers. The resulting
+expected error can be controlled.
+#create mess
+It is possible to use
+a small counter to keep
+approximate counts
+of large numbers. The resulting
+expected error can be controlled.
+#user
+#cmp mess Ref
+#log
+#next
+40.2d 5
diff --git a/usr.bin/learn/lib/editor/L40.2d b/usr.bin/learn/lib/editor/L40.2d
new file mode 100644
index 00000000000..8a738e49538
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L40.2d
@@ -0,0 +1,23 @@
+#print
+In file "poem" add the character "." (period)
+at the end of lines 3 through the end of the file.
+Then rewrite the file and type "ready".
+#create Ref
+When I was a lad I served a term
+ As office boy in an attorney's firm
+I washed the windows and I swept the floor.
+ And I polished up the handles on the big brass door.
+I polished up those handles so carefully.
+ That now I am the ruler of the Queen's Navy.
+#create poem
+When I was a lad I served a term
+ As office boy in an attorney's firm
+I washed the windows and I swept the floor
+ And I polished up the handles on the big brass door
+I polished up those handles so carefully
+ That now I am the ruler of the Queen's Navy
+#user
+#cmp poem Ref
+#log
+#next
+41.1a 10
diff --git a/usr.bin/learn/lib/editor/L41.1a b/usr.bin/learn/lib/editor/L41.1a
new file mode 100644
index 00000000000..f8ab0ab3b3f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L41.1a
@@ -0,0 +1,44 @@
+#print
+One thing you must be careful of is that the substitute
+command does not know about word boundaries. It will
+change the first occurrence of a letter string it matches
+without regard to blanks or punctuation around it. Thus,
+if the current line is
+ i would rather be the king
+and you type
+ s/the/a/p
+you get
+ i would raar be the king
+instead of
+ i would rather be a king
+Right? You should always print lines after changing them
+to avoid missing such errors. You can defend against them
+by increasing the amount of context you specify; in this
+case, for example, you could say
+ s/the /a /p
+and get
+ i would rather be a king
+Often the "$" operator is useful here, if you want to
+change the last thing on the line. In the file 'text',
+the third line reads
+ never, never, never, never, never
+Edit this file to make the third line read
+ never, never, never, never, or hardly ever
+Rewrite the file and type "ready".
+#create Ref
+why should a dog, a horse, a rat, have life,
+and thou no breath at all? thou'lt come no more,
+never, never, never, never, or hardly ever
+pray you, undo this button. thank you, sir.
+#create text
+why should a dog, a horse, a rat, have life,
+and thou no breath at all? thou'lt come no more,
+never, never, never, never, never
+pray you, undo this button. thank you, sir.
+#user
+#cmp text Ref
+#log
+#next
+42.1a 10
+41.1b 5
+42.2a 6
diff --git a/usr.bin/learn/lib/editor/L41.1b b/usr.bin/learn/lib/editor/L41.1b
new file mode 100644
index 00000000000..9d02aec5165
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L41.1b
@@ -0,0 +1,19 @@
+#print
+There is a mistyped word in the third line of the file "problem".
+Fix it, rewrite the file, and type "ready".
+#create Ref
+The computer costs too much.
+No one knows how to use it.
+The switchboard in the main office is broken.
+It takes too long to get anything done.
+#create problem
+The computer costs too much.
+No one knows how to use it.
+The switchboard in thb main office is broken.
+It takes too long to get anything done.
+#user
+#cmp problem Ref
+#log
+#next
+42.1a 10
+42.2a 5
diff --git a/usr.bin/learn/lib/editor/L42.1a b/usr.bin/learn/lib/editor/L42.1a
new file mode 100644
index 00000000000..4d04eb1c61e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L42.1a
@@ -0,0 +1,28 @@
+#print
+Normally the 's' command only changes
+the first instance on a line of the expression
+it is looking for. Sometimes you want to change
+more than one instance. If you put a 'g' after the
+command, as in
+ s/cat/dog/g
+all instances of 'cat' will be changed to 'dog'. To
+print the result you must say
+ s/cat/dog/gp
+('pg' at the end doesn't work, sorry).
+Edit file 'stuff' in this directory to change every
+instance of 'green' to 'red' on every line.
+Then rewrite the file and type "ready".
+#create Ref
+red light, village red
+red book, red paper, red pencil
+red car, red sign, redhorn
+#create stuff
+green light, village green
+green book, green paper, green pencil
+green car, green sign, greenhorn
+#user
+#cmp stuff Ref
+#log
+#next
+43.1a 10
+43.2a 5
diff --git a/usr.bin/learn/lib/editor/L42.2a b/usr.bin/learn/lib/editor/L42.2a
new file mode 100644
index 00000000000..ba649d4a39e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L42.2a
@@ -0,0 +1,24 @@
+#print
+Normally the 's' command only changes the first instance
+on a line of the expression it is recognizing. Sometimes you want
+to change everything. For example, try the following sequence,
+and note the difference between the changes on the two lines.
+
+ed test
+1,2p
+1s/cat/cats/p
+2s/cat/cats/gp
+w
+q
+ready
+#create Ref
+the cats in the catalog is a persian cat
+the cats in the catsalog is a persian cats
+#create test
+the cat in the catalog is a persian cat
+the cat in the catalog is a persian cat
+#user
+#cmp test Ref
+#log
+#next
+42.2b 5
diff --git a/usr.bin/learn/lib/editor/L42.2b b/usr.bin/learn/lib/editor/L42.2b
new file mode 100644
index 00000000000..dc2dd431f43
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L42.2b
@@ -0,0 +1,18 @@
+#print
+Now pick up the file 'stuff', change all instances of "green"
+everywhere to "red", and then rewrite the file and type "ready".
+#create Ref
+red light, village red
+red book, red paper, red pencil
+red car, red sign, redhorn
+red with envy
+#create stuff
+green light, village green
+green book, green paper, green pencil
+green car, green sign, greenhorn
+green with envy
+#user
+#cmp stuff Ref
+#log
+#next
+42.2c 5
diff --git a/usr.bin/learn/lib/editor/L42.2c b/usr.bin/learn/lib/editor/L42.2c
new file mode 100644
index 00000000000..5f1557add41
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L42.2c
@@ -0,0 +1,31 @@
+#print
+Remember the procedures with '*' for changing one or more
+of something into one something. Pick up the file
+"sloppy" and on every line, whereever there are several
+blanks in a row change them to one blank. This can be done
+with one command; it is a very common task. Then rewrite the file
+and type "ready".
+#create Ref
+It seems that medieval art
+ Alone retains its zest
+To charm and please its devotees
+ We've done our level best
+We're not quite sure that all we do
+ Has the Early English ring
+But as far as we can tell
+ It's something like this sort of thing.
+#create sloppy
+It seems that medieval art
+ Alone retains its zest
+To charm and please its devotees
+ We've done our level best
+We're not quite sure that all we do
+ Has the Early English ring
+But as far as we can tell
+ It's something like this sort of thing.
+#user
+#cmp sloppy Ref
+#log
+#next
+43.1a 10
+43.2a 5
diff --git a/usr.bin/learn/lib/editor/L43.1a b/usr.bin/learn/lib/editor/L43.1a
new file mode 100644
index 00000000000..e73468ed538
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L43.1a
@@ -0,0 +1,29 @@
+#print
+Note that there is quite a list of special characters
+recognized by the editor:
+ . [ * ^ $ & /
+What do you do when you want to specifically use
+one of these characters as itself, rather than
+for its funny meaning? You must precede it by a backslash,
+as in
+ s/\./,/p
+which will change the line
+ x, y. and z
+into
+ x, y, and z
+easily. The same works for all the other special
+characters. What command would change
+ *
+into
+ c
+Type "answer COMMAND" where COMMAND is of the form
+ s/.././p
+#copyin
+#user
+#uncopyin
+#match s/\*/c/p
+#match s/\*/c/
+You forgot the "p" on the end.
+#log
+#next
+44.1a 10
diff --git a/usr.bin/learn/lib/editor/L43.2a b/usr.bin/learn/lib/editor/L43.2a
new file mode 100644
index 00000000000..f8af90eadd2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L43.2a
@@ -0,0 +1,32 @@
+#print
+Note that there is quite a list of characters that
+are special to the editor:
+ . [ * ^ $ & /
+What do you do when you want to use one of these
+characters as itself, rather than for its special meaning?
+You must precede it by a backlash. For example, how
+would you turn
+ ".
+into
+ ."
+Try the following sequence:
+
+ed test
+1,3p
+1,3s/"\./."/p
+w
+q
+ready
+#create Ref
+This is a "quoted word."
+Here is "another."
+Be "careful." Especially with dots.
+#create test
+This is a "quoted word".
+Here is "another".
+Be "careful". Especially with dots.
+#user
+#cmp test Ref
+#log
+#next
+43.2b 5
diff --git a/usr.bin/learn/lib/editor/L43.2b b/usr.bin/learn/lib/editor/L43.2b
new file mode 100644
index 00000000000..68bf60a6b80
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L43.2b
@@ -0,0 +1,15 @@
+#print
+Pick up the file "line" and change
+ x, y. and z
+into
+ x, y, and z
+Then rewrite the file and type "ready".
+#create Ref
+ x, y, and z
+#create line
+ x, y. and z
+#user
+#cmp line Ref
+#log
+#next
+43.2c 5
diff --git a/usr.bin/learn/lib/editor/L43.2c b/usr.bin/learn/lib/editor/L43.2c
new file mode 100644
index 00000000000..30b606ecd6a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L43.2c
@@ -0,0 +1,23 @@
+#print
+This is trickier. Change all sequences of several
+asterisks into one asterisk. E.g.
+ *** xxx ****
+becomes
+ * xxx *
+The file is named "stars"; edit it
+and then rewrite it. Then type "ready".
+#create Ref
+ List of phone numbers
+ * 6377 *
+ * 4582 *
+ * 3968 *
+#create stars
+ List of phone numbers
+ ** 6377 ***
+ **** 4582 ****
+ * 3968 ***
+#user
+#cmp stars Ref
+#log
+#next
+43.2d 5
diff --git a/usr.bin/learn/lib/editor/L43.2d b/usr.bin/learn/lib/editor/L43.2d
new file mode 100644
index 00000000000..ab4195b26cd
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L43.2d
@@ -0,0 +1,19 @@
+#print
+This is trickier. File "name" contains
+ A T and T Co.
+Change it to read
+ A T & T Co.
+Then rewrite it and type "ready".
+#create Ref
+ A T & T Co.
+#create name
+ A T and T Co.
+#user
+#cmp name Ref
+#succeed
+I hope you used
+ s/and/\&/p
+and did not retype the line.
+#log
+#next
+44.1a 5
diff --git a/usr.bin/learn/lib/editor/L44.1a b/usr.bin/learn/lib/editor/L44.1a
new file mode 100644
index 00000000000..7ae6dd6a077
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1a
@@ -0,0 +1,43 @@
+#print
+You have now learned quite a bit about substitute commands.
+Here is a larger task to perform. There is a file 'song' in
+this directory. Edit it; print it out, and notice that
+there are six mistyped words in it. Fix all of them
+and rewrite the file. Then type "ready".
+#create Ref
+Oh, say can you see
+ by the dawn's early light
+What so proudly we hailed
+ at the twilight's last gleaming
+Whose broad stripes and bright stars
+ through the perilous night
+O'er the ramparts we watched
+ were so gallantly streaming
+And the rocket's red glare,
+ the bombs bursting in air
+Gave proof through the night
+ that our flag was still there
+Oh, say does that star spangled banner yet wave
+ o'er the land of the free
+And the home of the brave?
+#create song
+Oh, say can yuo see
+ by the dawn's early light
+What so proudly we hailed
+ at the twilight's last glieaming
+Whose broad stxripes and bright stxars
+ through the perilous night
+O'er the ramparts we watched
+ were so gallantly streammming
+And the rocket's red glare,
+ the bombs bursting in air
+Gave proof through thre night
+ that our flag was still there
+Oh, say does that star spangled banner yet wave
+ o'er the land of the free
+And the home of the brave?
+#user
+#cmp song Ref
+#log
+#next
+44.1b 10
diff --git a/usr.bin/learn/lib/editor/L44.1b b/usr.bin/learn/lib/editor/L44.1b
new file mode 100644
index 00000000000..ffe35d4d382
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1b
@@ -0,0 +1,35 @@
+#print
+There is a file named "paragraph" in this directory.
+It contains three spelling errors, one line is duplicated,
+and the last line is missing (the paragraph should end
+"has been carefully coded and is now well under control.").
+Fix it up and rewrite it. Then type "ready".
+#create Ref
+Held at arm's length, this program looks pretty impressive.
+There is a large assortment of data declarations, followed
+by a computation that is evidently complex enough
+to warrant a sub-procedure. Declarations are neatly
+aligned, and the executable statements are staggered so
+as to indicate several levels of control nesting.
+There are text strings to suggest the intent of the program,
+and mnemonic identifiers to give hints about how the results
+are obtained. The general impression conveyed is that
+this is a moderately complicated problem that
+has been carefully coded and is now well under control.
+#create paragraph
+Held at arm's length, this program looks pretty impressive.
+There is a large assortment of dta declarations, followed
+by a computation that is evidently complex enough
+to warrant a sub-procedure. Declarations are neatly
+aligned, and the executable statements are stagggered so
+as to indicate several levels of control nesting.
+as to indicate several levels of control nesting.
+There are text strings to suggest the intent of the program,
+and mnemonic identifiers to give hints about how the results
+are obtained. The genreal impression conveyed is that
+this is a moderately complicated problem that
+#user
+#cmp Ref paragraph
+#log
+#next
+44.1c 10
diff --git a/usr.bin/learn/lib/editor/L44.1c b/usr.bin/learn/lib/editor/L44.1c
new file mode 100644
index 00000000000..d3fee4d2ebb
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1c
@@ -0,0 +1,49 @@
+#print
+There is a file "list" in this directory which contains
+some names. Here are the addresses: add them on
+lines after the name (i.e. the file should look like:
+
+ Joe Blow
+ 45 Western Ave.
+ Elmira, NY 10445
+
+ Sam Jones
+ 97 Fifth St.
+ Oshkosh, WI 52302
+ ...
+when you are done).
+
+ Name address is
+Ford 1600 Pennsylvania Ave., Washington, DC 20515
+Fenwick 1 Morris St., Morristown, NJ 07960
+Rinaldo 308 Main St., Orange, NJ 07050
+Rodino 907 Broad St., Newark NJ 07102
+#create Ref
+The Hon. Gerald Ford
+1600 Pennsylvania Ave.
+Washington, DC 20515
+
+The Hon. Millicent Fenwick
+1 Morris St.
+Morristown, NJ 07960
+
+The Hon. Matthew Rinaldo
+308 Main St.
+Orange, NJ 07050
+
+The Hon. Peter Rodino
+907 Broad St.
+Newark, NJ 07102
+#create list
+The Hon. Gerald Ford
+
+The Hon. Millicent Fenwick
+
+The Hon. Matthew Rinaldo
+
+The Hon. Peter Rodino
+#user
+#cmp Ref list
+#log
+#next
+44.1d 10
diff --git a/usr.bin/learn/lib/editor/L44.1d b/usr.bin/learn/lib/editor/L44.1d
new file mode 100644
index 00000000000..5ac83dd0d90
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1d
@@ -0,0 +1,54 @@
+#print
+In file "locs" is a list of Bell Labs locations.
+Bring it up to date by
+ a) replace "Raritan River" by "Piscataway"
+ b) delete "Denville".
+ c) insert "Atlanta".
+ d) spell "Merrimack Valley" correctly.
+#create Ref
+Allentown
+Atlanta
+Centennial Park
+Chester
+Columbus
+Crawford Hill
+Denver
+Grand Forks
+Guilford Center
+Holmdel
+Indianapolis
+Indian Hill
+Kwajalein
+Madison
+Merrimack Valley
+Murray Hill
+Piscataway
+Reading
+Warren
+Whippany
+#create locs
+Allentown
+Centennial Park
+Chester
+Columbus
+Crawford Hill
+Denver
+Denville
+Grand Forks
+Guilford Center
+Holmdel
+Indianapolis
+Indian Hill
+Kwajalein
+Madison
+Merimack Valley
+Murray Hill
+Raritan River
+Reading
+Warren
+Whippany
+#user
+#cmp locs Ref
+#log
+#next
+44.1e
diff --git a/usr.bin/learn/lib/editor/L44.1e b/usr.bin/learn/lib/editor/L44.1e
new file mode 100644
index 00000000000..042df33fcac
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1e
@@ -0,0 +1,26 @@
+#print
+As you've probably noticed, the backslash character "\"
+is rather special to the editor (and to other programs
+as well). So what do you do when you have to somehow
+get a backslash into some text, or to edit it in
+or out?
+
+Getting it in in the first place is quite easy: when
+you are appending with "a" (or inserting with "i", or
+changing with "c", or reading with "r"), there's
+nothing special about "\" at all. To verify this,
+add the line
+
+Two backslashes \\ do not equal one forward slash.
+
+to the file "junk", re-write it, then type "ready".
+#create Ref
+This is a file with a silly line in it.
+Two backslashes \\ do not equal one forward slash.
+#create junk
+This is a file with a silly line in it.
+#user
+#cmp Ref junk
+#log
+#next
+44.1f 10
diff --git a/usr.bin/learn/lib/editor/L44.1f b/usr.bin/learn/lib/editor/L44.1f
new file mode 100644
index 00000000000..b1692874f8a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1f
@@ -0,0 +1,32 @@
+#print
+The next step is to learn how to edit a line
+that contains a backslash. On the left side of an "s"
+command, you place a "\" before the "\" to turn off
+its special meaning, just as for any other special
+character like "*" or "[". For example,
+if you have the line
+ c = '\n'
+you can change it into
+ c = 'n'
+with the command
+ s/\\n/n/
+or
+ s/\\//
+(Your choice.)
+
+Practice by removing all the backslashes from the
+file "junk"; when you're done, re-write it and
+type "ready".
+#create Ref
+Now is the time for all good
+men to come to the aid of
+their party, or something like that.
+#create junk
+Now is \the \tim\\e for all good
+m\\en \to com\\e \to \the aid of
+\their par\ty, or som\\e\thing like \tha\t.
+#user
+#cmp Ref junk
+#log
+#next
+44.1g 10
diff --git a/usr.bin/learn/lib/editor/L44.1g b/usr.bin/learn/lib/editor/L44.1g
new file mode 100644
index 00000000000..b0eb263675f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1g
@@ -0,0 +1,121 @@
+#print
+Of course, you can also search for lines that
+contain backslashes; again, it's simply a matter
+of doubling the backslash in the search pattern.
+That is,
+ /\\/
+finds the next line with a backslash.
+
+Find the second occurrence of "\n\n" in the file
+"prog.c", and type "answer N", where N is its
+line number.
+#create prog.c
+
+int nsave = 0;
+
+selunit()
+{
+ char fnam[20], s[50];
+ static char dobuff[50];
+ char posslev[20][20];
+ int diff[20], i, k, m, n, best, alts, statb[20];
+ FILE *f;
+ char zb[200];
+ static char saved[20];
+
+ while (ask) {
+ printf("What lesson? ");
+ fflush(stdout);
+ gets(dobuff);
+ if (strcmp(dobuff, "bye") == 0)
+ wrapup(0);
+ level = todo = dobuff;
+ sprintf(s, "../L%s", dobuff);
+ if (access(s, 04) == 0)
+ return;
+ printf("no such lesson\n");
+ }
+ alts = 0;
+retry:
+ f=scrin;
+ if (f==NULL) {
+ sprintf(fnam, "../L%s", level);
+ f = fopen(fnam, "r");
+ if (f==NULL) {
+ fprintf(stderr, "No script for lesson %s.\n", level);
+ wrapup(1);
+ }
+ while (fgets(zb, 200, f)) {
+ trim(zb);
+ if (strcmp(zb, "#next")==0)
+ break;
+ }
+ }
+ if (feof(f)) {
+ printf("Congratulations\n\n.You have finished this sequence.\n");
+ fflush(stdout);
+ todo = 0;
+ return;
+ }
+ for(i=0; fgets(s, 50, f); i++) {
+ sscanf(s, "%s %d", &posslev[i], &diff[i]);
+ }
+ best = -1;
+ /* cycle through lessons from random start */
+ /* first try the current place, failing that back up to
+ last place there are untried alternatives (but only one backup) */
+ n = grand()%i;
+ for(k=0; k<i; k++) {
+ m = (n+k)%i;
+ if (already(posslev[m])) continue;
+ if (best<0) best=m;
+ /* real alternatives */
+ alts++;
+ if (abs(diff[m]-speed) < abs(diff[best]-speed))
+ best=m;
+ }
+ if (best < 0 && nsave) {
+ nsave--;
+ strcpy(level, saved);
+ goto retry;
+ }
+ if (best <0) {
+ /* lessons exhausted or missing */
+ printf("Sorry, there are no alternative lessons at this stage.\n");
+ printf("See someone for help.\n\n");
+ fflush(stdout);
+ todo = 0;
+ return;
+ }
+ strcpy (dobuff, posslev[best]);
+ if (alts>1) {
+ nsave=1;
+ strcpy (saved, level);
+ }
+ todo = dobuff;
+ fclose(f);
+}
+
+abs(x)
+{
+ return(x>=0? x: -x);
+}
+
+grand()
+{
+ static int garbage;
+ int a[2], b;
+
+ time(a);
+ b = a[1]+10*garbage++;
+ return(b&077777);
+}
+#copyin
+#user
+#uncopyin
+#match 73
+#bad 43
+The second______ one.
+#log
+#next
+44.1h 10
diff --git a/usr.bin/learn/lib/editor/L44.1h b/usr.bin/learn/lib/editor/L44.1h
new file mode 100644
index 00000000000..c8db43ef05f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1h
@@ -0,0 +1,29 @@
+#print
+The next trick is to substitute a "\" into a line.
+The same idea holds: simply double the backslash,
+but this time on the right side of the "s" command.
+
+In the file "prog.c", convert every
+ 'n'
+into
+ "\n"
+Re-write the file, and type "ready".
+#create Ref
+ x = "\n";
+ y = 'nop';
+ z = 'lmn';
+ q = "n";
+ r = "\n"+1;
+ s = "\n" - "\n";
+#create prog.c
+ x = 'n';
+ y = 'nop';
+ z = 'lmn';
+ q = "n";
+ r = 'n'+1;
+ s = 'n' - 'n';
+#user
+#cmp Ref prog.c
+#log
+#next
+44.1i 10
diff --git a/usr.bin/learn/lib/editor/L44.1i b/usr.bin/learn/lib/editor/L44.1i
new file mode 100644
index 00000000000..df4964cfdcc
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L44.1i
@@ -0,0 +1,19 @@
+#print
+One last one with "\". Add the following to
+the end of the first line in file "temp",
+separated by a single blank.
+
+/* &"\n" isn't &'\n' */
+
+You can do it by re-typing the line, but it's
+a nice exercise to use "s".
+Type "ready" after you have re-written the file.
+#create Ref
+p = &"\n"; /* &"\n" isn't &'\n' */
+#create temp
+p = &"\n";
+#user
+#cmp temp Ref
+#log
+#next
+45.1a 10
diff --git a/usr.bin/learn/lib/editor/L45.1a b/usr.bin/learn/lib/editor/L45.1a
new file mode 100644
index 00000000000..c2174f988b9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L45.1a
@@ -0,0 +1,36 @@
+#print
+There is one last class of substitutions that
+you should know about: converting one line
+into two or more by substituting a newline
+into the middle. Suppose you want to split the
+line
+ Now is the time for all good men
+into
+ Now is the time
+ for all good men
+without re-typing. The substitute command is
+ s/time /time\
+ /
+The backslash indicates that a newline is to be
+inserted at that point; the rest of the "s"
+command is actually typed on a new line.
+
+Practice by splitting the first line in file
+"btl" into
+
+Bell Laboratories
+Murray Hill, NJ 07974
+
+using the "s" command as illustrated above.
+Be sure to delete the comma and space properly.
+Re-write the file, then type "ready".
+#create Ref
+Bell Laboratories
+Murray Hill, NJ 07974
+#create btl
+Bell Laboratories, Murray Hill, NJ 07974
+#user
+#cmp btl Ref
+#log
+#next
+45.1b
diff --git a/usr.bin/learn/lib/editor/L45.1b b/usr.bin/learn/lib/editor/L45.1b
new file mode 100644
index 00000000000..a02865e73f4
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L45.1b
@@ -0,0 +1,34 @@
+#print
+The opposite command to splitting is joining.
+But this isn't done with a "s" as you might expect;
+it uses an entirely separate command called "j"
+(for "join"). To join two or more adjacent (!)
+lines, such as lines 3 through 6, simply type
+ 3,6j
+You can add a "p" at the end to see the result.
+
+If you don't specify any lines, "j" by itself joins
+line "." and ".+1".
+In no case does "j" add any extra blanks -- you have
+to put them in for yourself if you want them.
+
+The file "split" has six lines. Convert it into
+three lines by joining 1 and 2, 3 and 4, and 5 and 6.
+Make sure that the words are separated by spaces.
+Re-write, then type "ready".
+#create Ref
+Check your arithmetic: avoid costly mistakes.
+Attach W-2 forms: they must be attached to your return.
+Sign your return: your spouse must sign too.
+#create split
+Check your arithmetic:
+avoid costly mistakes.
+Attach W-2 forms:
+they must be attached to your return.
+Sign your return:
+your spouse must sign too.
+#user
+#cmp Ref split
+#log
+#next
+50.1a
diff --git a/usr.bin/learn/lib/editor/L5.1a b/usr.bin/learn/lib/editor/L5.1a
new file mode 100644
index 00000000000..0dc34fddd7e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L5.1a
@@ -0,0 +1,29 @@
+#print
+The most frequently used editor command is
+ p
+which prints out a line. Try that now.
+Type the command sequence
+
+p
+w
+q
+
+to print out a line, and then write out the file.
+Then type "ready".
+#create Ref
+This is the line to be printed. Don't forget w, then q.
+56
+#create file
+This is the line to be printed. Don't forget w, then q.
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X2
+#cmp Ref X2
+#log
+#next
+6.1a 5
+6.2a 2
diff --git a/usr.bin/learn/lib/editor/L50.1a b/usr.bin/learn/lib/editor/L50.1a
new file mode 100644
index 00000000000..81bd91d9d7f
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.1a
@@ -0,0 +1,36 @@
+#print
+So far all the addresses you have used have been
+either line numbers, '$', or '.' (or combinations
+thereof). The most useful addresses are none of
+those, but are specifications of lines by content.
+Anything you can ask the substitute command
+to find in a line, you can ask the editor to find
+in a file. In particular,
+ /xx/p
+is a valid command with a line address
+ /xx/
+and the 'p' command operator. The address
+ /xx/
+means 'the next line containing an "xx"'.
+So this command prints out the next line which
+has an "xx" on it. Edit the file 'text' and
+print the line which has 'cat' on it. Then
+leave the editor and type "ready".
+#create text
+This is a short list of
+things you might find
+in the Sears, Roebuck
+catalog.
+ tools
+ furniture
+ electrical parts
+ clothes
+ appliances
+ garden equipment.
+#copyout
+#user
+#uncopyout
+grep catalog\. .ocopy >/dev/null
+#log
+#next
+50.1b 10
diff --git a/usr.bin/learn/lib/editor/L50.1b b/usr.bin/learn/lib/editor/L50.1b
new file mode 100644
index 00000000000..0dd3895f809
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.1b
@@ -0,0 +1,31 @@
+#print
+You can use all the special characters in the
+search commands. For example,
+ /^cat/p
+prints the first line that BEGINS with 'cat'.
+You can even leave out the 'p':
+ /^cat/
+does the same thing.
+
+Now go into file 'text' with the editor and
+print the first line that ENDS with 'dog'.
+Then leave the editor and type 'ready'.
+#create text
+This is a file which
+contains several occurrences
+of the word 'dog' in several
+places. It would be a doggone
+shame if you didn't find
+the right dog
+to print out.
+#copyout
+#user
+#uncopyout
+grep 'dog$' text >X1
+grep 'dog' .ocopy >X3
+tail -1 X3 >X2
+#cmp X1 X2
+#log
+#next
+50.1c 10
+50.2c 5
diff --git a/usr.bin/learn/lib/editor/L50.1c b/usr.bin/learn/lib/editor/L50.1c
new file mode 100644
index 00000000000..3ed8c33e157
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.1c
@@ -0,0 +1,54 @@
+#print
+You can use other commands than 'p' with these
+context search addresses, of course. For example,
+ /abc.e/s/ab/xx/p
+will
+ (1) search for the next line containing the
+ expression "abc.e", which matches any line that
+ has an 'a', then a 'b', then a 'c', then
+ anything, then an 'e' (so that it matches
+ "abcde", "abcxe", "abc9e", but not "abceq");
+ (2) on that line, change the first "ab" to an "xx".
+Edit file 'county'; find the line with 'pacific' on it
+and change it to 'ocean'. Then rewrite the file
+and type "ready".
+#create Ref
+passaic
+bergen
+sussex
+hudson
+essex
+warren
+morris
+hunderdon
+somerset
+union
+ocean
+monmouth
+middlesex
+mercer
+cumberland
+cape may
+#create county
+passaic
+bergen
+sussex
+hudson
+essex
+warren
+morris
+hunderdon
+somerset
+union
+pacific
+monmouth
+middlesex
+mercer
+cumberland
+cape may
+#user
+#cmp county Ref
+#log
+#next
+51.1a 10
+50.2e 5
diff --git a/usr.bin/learn/lib/editor/L50.2c b/usr.bin/learn/lib/editor/L50.2c
new file mode 100644
index 00000000000..72853d2a1c8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.2c
@@ -0,0 +1,23 @@
+#print
+Edit file "junk" and print the first line
+that contains either "color" or "Color".
+Then leave the editor and type "ready".
+#create junk
+this file contains
+a few random lines
+much noise
+bright Colors
+other stuff
+colored paper
+and color by Technicolor
+#create x2
+bright Colors
+#copyout
+#user
+#uncopyout
+grep olor .ocopy >x1
+#cmp x1 x2
+#log
+#next
+50.2d 5
+50.1c 10
diff --git a/usr.bin/learn/lib/editor/L50.2d b/usr.bin/learn/lib/editor/L50.2d
new file mode 100644
index 00000000000..48ad25798de
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.2d
@@ -0,0 +1,33 @@
+#print
+In file "text" print the first
+line which contains any of the
+words "them", "these", "their", or "there"
+(you need only distinguish "the"; that is,
+look for the letters "t", "h", and "e" followed
+by something other than a blank). Delete the
+line you find ; then rewrite the file
+and type "ready".
+#create Ref
+the leaves do not have enough room to hold all the food
+that plants make. much of the food has to be stored in remote parts
+of the plant.
+we eat the parts of plants where the most food is stored. the
+carrot plant stores food in its roots. We eat the roots of carrots.
+the celery plant stores food in its leaf stalks, which are the parts
+the fruits of these plants to get the stored food in them.
+ some kinds of plants have ways of protecting their stored food.
+#create text
+the leaves do not have enough room to hold all the food
+that plants make. much of the food has to be stored in remote parts
+of the plant.
+we eat the parts of plants where the most food is stored. the
+carrot plant stores food in its roots. We eat the roots of carrots.
+the celery plant stores food in its leaf stalks, which are the parts
+we eat. many kinds of plants store food in their fruits. we eat
+the fruits of these plants to get the stored food in them.
+ some kinds of plants have ways of protecting their stored food.
+#user
+#cmp text Ref
+#log
+#next
+50.1c 10
diff --git a/usr.bin/learn/lib/editor/L50.2e b/usr.bin/learn/lib/editor/L50.2e
new file mode 100644
index 00000000000..73408a0246d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.2e
@@ -0,0 +1,28 @@
+#print
+Please edit a file named "news" and find the
+first word containing the three letters "ufa".
+Make the word plural, rewrite the file, and
+type "ready".
+#create Ref
+It was announced today in
+Washington that the GNP was
+up at an annual rate of 8.2 %
+in the third quarter of 1975.
+Fishing and agriculture declined
+slightly but manufactures increased
+substantially. The overall gain
+was impressive and confirms economic recovery.
+#create news
+It was announced today in
+Washington that the GNP was
+up at an annual rate of 8.2 %
+in the third quarter of 1975.
+Fishing and agriculture declined
+slightly but manufacture increased
+substantially. The overall gain
+was impressive and confirms economic recovery.
+#user
+#cmp news Ref
+#log
+#next
+50.2f 10
diff --git a/usr.bin/learn/lib/editor/L50.2f b/usr.bin/learn/lib/editor/L50.2f
new file mode 100644
index 00000000000..f25f7153474
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.2f
@@ -0,0 +1,343 @@
+#print
+Look in the file "story". Somewhere is a line
+containing the word "season". Find it, and find
+what line number it has. Leave the editor
+and type "answer N" where N is the line number
+of the line containing the word "season".
+The file is too long for you to print it all,
+by the way.
+#create story
+All
+of
+the
+Big
+Cats,
+as
+well
+as
+the
+lesser
+ones,
+have
+wonderful
+eyes.
+They
+can
+see
+clearly
+even
+on
+a
+dark
+night.
+this
+is
+because
+of
+the
+way
+they
+are
+made.
+There
+is
+a
+sort
+of
+window
+in
+each
+eye.
+This
+window
+is
+called
+the
+pupil.
+It
+is
+black
+and
+is
+placed
+in
+the
+center
+of
+the
+colored
+part
+of
+the
+eye.
+The
+pupil
+lets
+light
+come
+in
+and
+reach
+a
+kind
+of
+mirror
+at
+the
+back
+of
+each
+eye.
+These
+mirrors
+reflect
+everything
+that
+is
+in
+front
+of
+the
+eyes.
+Right
+away
+a
+special
+nerve
+carries
+these
+reflected
+pictures
+to
+the
+brain.
+I'm
+learning
+to
+be
+a
+detective
+--
+not
+the
+kind
+who
+solves
+crimes
+from
+fingerprints,
+pieces
+of
+clothing,
+or
+the
+cross-examining
+of
+witnesses
+--
+I'm
+learning
+to
+be
+a
+nature
+detective.
+The
+mysteries
+I
+trace
+happen
+in
+the
+woods,
+in
+the
+park,
+and
+in
+my
+own
+backyard.
+Animals
+come
+and
+go
+when
+I'm
+not
+there
+to
+see
+them,
+but
+usually
+they
+leave
+clues
+behind.
+From
+such
+clues
+and
+other
+animal
+signs,
+you
+and
+I
+will
+piece
+together
+some
+exciting
+stories.
+We
+will
+detect
+which
+animals
+went
+where,
+what
+they
+did,
+and
+sometimes
+what
+they
+ate.
+Whenever
+there
+is
+snow
+on
+the
+ground,
+you
+are
+sure
+to
+find
+track
+stories
+written
+in
+it.
+Animals
+travel
+by
+air
+by
+water
+and
+by
+land.
+Some
+run
+very
+fast.
+Some
+hop
+or
+jump
+along
+the
+ground.
+Others
+walk
+more
+slowly,
+or
+crawl
+still
+more
+slowly.
+Do
+you
+know
+that
+plants
+are
+travelers,
+too?
+And
+that
+they
+also
+travel
+by
+land,
+by
+water
+and
+by
+air?
+Most
+plants
+stay
+in
+the
+same
+spot
+from
+the
+time
+they
+begin
+to
+grow
+until
+they
+die.
+But
+the
+next
+season
+you
+find
+many
+of
+them
+growing
+in
+new
+places.
+How
+do
+they
+get
+there?
+Some
+plants
+travel
+by
+land.
+They
+have
+seeds
+that
+fall
+to
+the
+ground
+and
+grow
+there.
+Others
+send
+out
+offshoots
+or
+sprouts
+which
+start
+new
+plants
+nearby.
+#copyin
+#user
+#uncopyin
+#match 286
+#log
+#next
+50.2g 10
diff --git a/usr.bin/learn/lib/editor/L50.2g b/usr.bin/learn/lib/editor/L50.2g
new file mode 100644
index 00000000000..3690bbb08d7
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L50.2g
@@ -0,0 +1,52 @@
+#print
+The file "amend" contains an erroneous copy of the first
+four amendments to the Constitution. Find the line
+saying "suspicion" and change it to read
+"but upon probable cause, supported by oath or affirmation,"
+and then rewrite the file and type "ready".
+#create Ref
+1. Congress shall make no law respecting an establishment of religion,
+or prohibiting the free exercise thereof; or abridging the freedom of speech,
+or of the press; or the right of the people peaceably to assemble,
+and to petition the Government for a redress of grievances.
+
+2. A well regulated Militia, being necessary to the security
+of a free State, the right of the people to keep and bear arms
+shall not be infringed.
+
+3. No Soldier shall, in time of peace, be quartered
+in any house without the consent of the Owner, nor in time
+of war, but in a manner to be prescribed by law.
+
+4. The right of the people to be secure in their persons,
+houses, papers, and effects, against unreasonable searches and
+seizures, shall not be violated, and no Warrants shall issue,
+but upon probable cause, supported by oath or affirmation,
+and particularly describing the place to be searched, and the
+persons or things to be seized.
+#create amend
+1. Congress shall make no law respecting an establishment of religion,
+or prohibiting the free exercise thereof; or abridging the freedom of speech,
+or of the press; or the right of the people peaceably to assemble,
+and to petition the Government for a redress of grievances.
+
+2. A well regulated Militia, being necessary to the security
+of a free State, the right of the people to keep and bear arms
+shall not be infringed.
+
+3. No Soldier shall, in time of peace, be quartered
+in any house without the consent of the Owner, nor in time
+of war, but in a manner to be prescribed by law.
+
+4. The right of the people to be secure in their persons,
+houses, papers, and effects, against unreasonable searches and
+seizures, shall not be violated, and no Warrants shall issue,
+but upon suspicion,
+and particularly describing the place to be searched, and the
+persons or things to be seized.
+#user
+#cmp amend Ref
+#log
+#next
+51.1a 10
+51.2a 5
diff --git a/usr.bin/learn/lib/editor/L51.1a b/usr.bin/learn/lib/editor/L51.1a
new file mode 100644
index 00000000000..3012c3492ad
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L51.1a
@@ -0,0 +1,25 @@
+#print
+You can also use relative addresses of the +1 or -1
+sort with context searches. For example, to
+print the line after a line containing "cat",
+you can say
+ /cat/+1p
+How would you print the line before the next line
+containing the word "help" at the beginning
+of the line? Try some experiments if you want,
+but in the end type "answer COMMAND" where COMMAND
+is the correct command to do that.
+#copyin
+#user
+#uncopyin
+#match /^help/-1p
+#match /^help/-1
+#match /^help/-
+#match /^help/-p
+#succeed
+The "p" isn't necessary, of course.
+#cmp X1 X2
+#log
+#next
+52.1a 10
+52.2a 5
diff --git a/usr.bin/learn/lib/editor/L51.2a b/usr.bin/learn/lib/editor/L51.2a
new file mode 100644
index 00000000000..5b1ffb2e3c9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L51.2a
@@ -0,0 +1,83 @@
+#print
+You can also use relative addresses of the +1 or -1
+sort with context searches. For example, to print the
+line after the line containing "cat", you could say
+
+ /cat/+1p
+
+Here is a file "text". Print the line before the line
+containing "florin". Then leave the editor and type "ready".
+#create text
+ The United Netherlands are a confederacy of republics,
+or rather of aristocracies of a very remarkable texture, yet
+confirming all the lessons derived from those which we
+have already reviewed.
+ The union is composed of seven coequal and sovereign
+states, and each state or province is a composition of
+equal and independent cities. In all important cases, not
+only the provinces but the cities must be unanimous.
+ The sovereignty of the union is represented by the
+States-General, consisting usually of about fifty deputies
+appointed by the provinces. They hold their seats, some
+for life, some for six, three, and one years; from two
+provinces they continue in appointment during pleasure.
+ The States-General have authority to enter into
+treaties and alliances; to make war and peace; to raise
+armies and equip fleets; to ascertain quotas and
+demand contributions. In all these cases, however, unanimity
+and sanction of their constituents are requisite.
+They have authority to appoint and receive ambassadors;
+to execute treaties and alliances already formed; to
+provide for the collection of duties on imports and exports;
+to regulate the mint with a saving to the provincial
+rights; to govern as sovereigns the dependent territories.
+The provinces are restrained, unless with the general
+consent, from entering into foreign treaties; from
+establishing imposts injurious to others, or charging
+their neighbors with higher duties than their own subjects. A
+council of state, a chamber of accounts, with five colleges
+of admiralty, aid and fortify the federal administration.
+ The executive magistrate of the Union is the
+stadtholder, who is now an hereditary prince. His principal
+weight and influence in the republic are derived from his
+independent title; from his great patrimonial estates;
+from his family connections with some of the chief
+potentates of Europe; and, more that all, perhaps, from his
+being stadtholder in the several provinces, as well as for
+the Union; in which provincial quality he has the
+appointment of town magistrates under certain regulations,
+executes provincial decrees, presides when he pleases in
+the provincial tribunals, and has throughout the power
+of pardon.
+ As stadtholder of the Union, he has, however,
+considerable prerogatives.
+ In his political capacity he has authority to settle
+disputes between the provinces, when other methods fail; to
+assist at the deliberations of the States-General and at
+their particular conferences; to give audiences to foreign
+ambassadors and to keep agents for his particular affairs
+at foreign courts.
+ In his military capacity he commands the federal
+troops, provides for garrisons, and in general regulates
+military affairs; disposes of all appointments, from
+colonels to ensigns, and of the governments and posts of
+fortified towns.
+ In his marine capacity he is admiral-general and
+superintends and directs every thing relative to naval forces
+and other naval affairs; presides in the admiralties in
+person or by proxy; appoints lieutenant-admirals and
+other officers; and establishes councils of war, whose
+sentences are not executed till he approves them.
+ His revenue, exclusive of his private income, amounts
+to 300,000 florins. The standing army which he commands
+consists of about 40,000 men.
+#create x2
+ His revenue, exclusive of his private income, amounts
+#copyout
+#user
+#uncopyout
+grep exclusive .ocopy >x1
+#cmp x1 x2
+#log
+#next
+51.2b 5
diff --git a/usr.bin/learn/lib/editor/L51.2b b/usr.bin/learn/lib/editor/L51.2b
new file mode 100644
index 00000000000..0d093f3ef0d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L51.2b
@@ -0,0 +1,21 @@
+#print
+Suppose you have a memo in a file and
+the line with the title is preceded by a line
+with "TL" on it. What command would print
+the title? Reply
+
+answer COMMAND
+
+where COMMAND is the search-and-print command to do that.
+#copyin
+#user
+#uncopyin
+#match /TL/+1p
+#match /TL/+
+#match /TL/1
+#match /TL/1p
+#match /TL/+p
+#match /TL/+1
+#log
+#next
+51.2c 5
diff --git a/usr.bin/learn/lib/editor/L51.2c b/usr.bin/learn/lib/editor/L51.2c
new file mode 100644
index 00000000000..7f42ccacb1c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L51.2c
@@ -0,0 +1,93 @@
+#print
+How would you look for a blank line? Do you
+understand
+
+ /^$/p
+
+Note this command: it looks for the beginning of the
+line, followed immediately by the end of the line. If
+there are any characters in between, it will keep
+looking for a line with no__ characters at all. All right.
+The file "text" contains an extraneous blank line.
+Delete it and rewrite the file.
+#create Ref
+ When the people of America reflect that they are now
+called upon to decide a question, which in its consequences
+must prove one of the most important that ever
+engaged their attention, the propriety of their taking a
+very comprehensive, as well as a very serious, view of it
+will be evident.
+ Nothing is more certain than the indispensable necessity
+of government; and it is equally undeniable that
+whenever and however it is instituted, the people must
+cede to it some of their natural rights, in order to vest it
+with requisite powers. It is well worthy of consideration,
+therefore, whether it would conduce more to the interest
+of the people of America that they should, to all
+general purposes, be one nation, under one federal government,
+than that they should divide themselves into
+separate confederacies and give to the head of each the
+same kind of powers which they are advised to place in
+one national government.
+ It has until lately been a received and uncontradicted
+opinion that the prosperity of the people of America
+depended on their continuing firmly united, and the wishes,
+prayers, and efforts of our best and wisest citizens have
+been constantly directed to that object. But politicians
+now appear who insist that this opinion is erroneous,
+and that instead of looking for safety and happiness in
+union, we ought to seek it in a division of the States
+into distinct confederacies or sovereignties. However
+extraordinary this new doctrine may appear, it nevertheless
+has its advocates; and certain characters who were
+much opposed to it formerly are at present of the number.
+Whatever may be the arguments or inducements
+which have wrought this change in the sentiments and
+declarations of these gentlemen, it certainly would not be
+wise in the people at large to adopt these new political
+tenets without being fully convinced that they are founded
+in truth and sound policy.
+#create text
+ When the people of America reflect that they are now
+called upon to decide a question, which in its consequences
+must prove one of the most important that ever
+engaged their attention, the propriety of their taking a
+very comprehensive, as well as a very serious, view of it
+will be evident.
+ Nothing is more certain than the indispensable necessity
+of government; and it is equally undeniable that
+whenever and however it is instituted, the people must
+cede to it some of their natural rights, in order to vest it
+with requisite powers. It is well worthy of consideration,
+therefore, whether it would conduce more to the interest
+of the people of America that they should, to all
+general purposes, be one nation, under one federal government,
+than that they should divide themselves into
+separate confederacies and give to the head of each the
+same kind of powers which they are advised to place in
+one national government.
+ It has until lately been a received and uncontradicted
+opinion that the prosperity of the people of America
+depended on their continuing firmly united, and the wishes,
+prayers, and efforts of our best and wisest citizens have
+been constantly directed to that object. But politicians
+now appear who insist that this opinion is erroneous,
+and that instead of looking for safety and happiness in
+union, we ought to seek it in a division of the States
+into distinct confederacies or sovereignties. However
+extraordinary this new doctrine may appear, it nevertheless
+has its advocates; and certain characters who were
+much opposed to it formerly are at present of the number.
+Whatever may be the arguments or inducements
+which have wrought this change in the sentiments and
+declarations of these gentlemen, it certainly would not be
+wise in the people at large to adopt these new political
+
+tenets without being fully convinced that they are founded
+in truth and sound policy.
+#user
+#cmp Ref text
+#log
+#next
+52.1a 10
+52.2a 5
diff --git a/usr.bin/learn/lib/editor/L52.1a b/usr.bin/learn/lib/editor/L52.1a
new file mode 100644
index 00000000000..c1d36b76692
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L52.1a
@@ -0,0 +1,71 @@
+#print
+A very powerful tool is to use pairs of addresses
+which include searches. For example, to print
+all lines from the present line to the next line
+containing "stop", say
+ .,/stop/p
+(remember that "." is the present line). In this
+directory is a file "outline". Find the line that
+begins "B.3.i". Note that this line, and the next
+few lines, should begin "A..." for consistency.
+(Print the whole file to see what's wrong).
+Change all lines from this line to
+the line beginning "B.3.v" to begin "A.3".
+Then rewrite the file and type "ready".
+#create Ref
+First section
+A.1.i Introduction
+A.1.ii Definitions
+Second section
+A.2.i Scope
+A.2.ii Date effective
+A.2.iii Who covered
+Third section
+A.3.i Governing committee
+A.3.ii Chairman's election
+A.3.iii Board terms
+A.3.iv Board elections
+A.3.v Removal procedure
+Fourth section
+A.4.i Meetings
+A.4.ii Place of meeting
+A.4.iii Frequency of meetings
+Fifth section
+A.5.i Record keeping
+A.5.ii Corresponding secretary
+A.5.iii Recording secretary
+A.5.iv Financial records
+#create outline
+First section
+A.1.i Introduction
+A.1.ii Definitions
+Second section
+A.2.i Scope
+A.2.ii Date effective
+A.2.iii Who covered
+Third section
+B.3.i Governing committee
+B.3.ii Chairman's election
+B.3.iii Board terms
+B.3.iv Board elections
+B.3.v Removal procedure
+Fourth section
+A.4.i Meetings
+A.4.ii Place of meeting
+A.4.iii Frequency of meetings
+Fifth section
+A.5.i Record keeping
+A.5.ii Corresponding secretary
+A.5.iii Recording secretary
+A.5.iv Financial records
+#user
+#cmp outline Ref
+#succeed
+You got it right: I hope you found that the easiest
+way to change the file would be with the commands
+ /B.3.i/p
+ .,/B.3.v/s/B/A/
+or some such series.
+#log
+#next
+52.1b 10
diff --git a/usr.bin/learn/lib/editor/L52.1b b/usr.bin/learn/lib/editor/L52.1b
new file mode 100644
index 00000000000..2ccba77de9a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L52.1b
@@ -0,0 +1,60 @@
+#print
+Even more powerful is to use two context
+searches for the pair of addresses
+in front of a command. For example
+ /abc/,/def/p
+will print all lines from the one that
+contains "abc" to the one that contains
+"def". In this directory is a file
+"phone". On every line between
+"Pinson" and "Johnson" change "tel" to "ext".
+(Again, print the whole file first to see
+what's going on here and why the file is bad.)
+Then rewrite the corrected file and
+type "ready".
+#create Ref
+ telephone numbers
+
+McIlroy M D ext 6050
+Aho A V ext 4862
+Baker B S ext 6503
+Cherry L L ext 6067
+Knowlton K ext 2328
+Morris R ext 3878
+Ossanna J F ext 3520
+Thompson K ext 2394
+
+Pinson E N ext 2582
+Bourne S R ext 7419
+Elliot R J ext 2879
+Fraser A G ext 3685
+Johnson S C ext 3968
+Kernighan B W ext 6021
+Ritchie D M ext 3770
+Vollaro J R ext 6321
+#create phone
+ telephone numbers
+
+McIlroy M D ext 6050
+Aho A V ext 4862
+Baker B S ext 6503
+Cherry L L ext 6067
+Knowlton K ext 2328
+Morris R ext 3878
+Ossanna J F ext 3520
+Thompson K ext 2394
+
+Pinson E N tel 2582
+Bourne S R tel 7419
+Elliot R J tel 2879
+Fraser A G tel 3685
+Johnson S C tel 3968
+Kernighan B W ext 6021
+Ritchie D M ext 3770
+Vollaro J R ext 6321
+#user
+#cmp phone Ref
+#log
+#next
+53.1a 10
+52.2c 5
diff --git a/usr.bin/learn/lib/editor/L52.2a b/usr.bin/learn/lib/editor/L52.2a
new file mode 100644
index 00000000000..f8858c6f9dd
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L52.2a
@@ -0,0 +1,61 @@
+#print
+You can use pairs of addresses which involve searches. For example,
+to print all lines from the first line until the next line containing
+"stop", say
+
+ 1,/stop/p
+
+In this directory is a file "list". Print all lines from
+the first line to a line containing "023". Then leave the editor
+and type "ready".
+#create list
+bio011
+bio012
+bio013
+bio014
+bio015
+bio016
+bio017
+bio021
+bio022
+bio023
+bio024
+bio025
+bio026
+bio027
+bio028
+bio031
+bio032
+bio033
+bio034
+bio035
+bio036
+bio037
+bio038
+bio041
+bio042
+bio043
+bio044
+bio045
+bio046
+bio047
+bio051
+#create x2
+bio011
+bio012
+bio013
+bio014
+bio015
+bio016
+bio017
+bio021
+bio022
+bio023
+#copyout
+#user
+#uncopyout
+grep bio .ocopy >x1
+#cmp x1 x2
+#log
+#next
+52.2b 5
diff --git a/usr.bin/learn/lib/editor/L52.2b b/usr.bin/learn/lib/editor/L52.2b
new file mode 100644
index 00000000000..ce292b2b289
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L52.2b
@@ -0,0 +1,65 @@
+#print
+In this directory is a file "outline". Find the line that
+begins "B.3.i". Note that this line, and the next few
+lines, should begin "A"... for consistency.
+(Print the whole file to see what is going on. It's fairly short.)
+Change all lines from the line beginning "B.3.i" to the line
+beginning "B.3.v" to begin "A.3". Then rewrite the file
+and type "ready".
+#create Ref
+First section
+A.1.i Introduction
+A.1.ii Definitions
+Second section
+A.2.i Scope
+A.2.ii Date effective
+A.2.iii Who covered
+Third section
+A.3.i Governing committee
+A.3.ii Chairman's election
+A.3.iii Board terms
+A.3.iv Board elections
+A.3.v Removal procedure
+Fourth section
+A.4.i Meetings
+A.4.ii Place of meeting
+A.4.iii Frequency of meetings
+Fifth section
+A.5.i Record keeping
+A.5.ii Corresponding secretary
+A.5.iii Recording secretary
+A.5.iv Financial records
+#create outline
+First section
+A.1.i Introduction
+A.1.ii Definitions
+Second section
+A.2.i Scope
+A.2.ii Date effective
+A.2.iii Who covered
+Third section
+B.3.i Governing committee
+B.3.ii Chairman's election
+B.3.iii Board terms
+B.3.iv Board elections
+B.3.v Removal procedure
+Fourth section
+A.4.i Meetings
+A.4.ii Place of meeting
+A.4.iii Frequency of meetings
+Fifth section
+A.5.i Record keeping
+A.5.ii Corresponding secretary
+A.5.iii Recording secretary
+A.5.iv Financial records
+#user
+#cmp outline Ref
+#succeed
+You got it right: I hope you found that the easiest
+way to change the file would be with the commands
+ /B.3.i/p
+ .,/B.3.v/s/B/A/
+or some such series.
+#log
+#next
+52.1b 10
diff --git a/usr.bin/learn/lib/editor/L52.2c b/usr.bin/learn/lib/editor/L52.2c
new file mode 100644
index 00000000000..b9d31ba624c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L52.2c
@@ -0,0 +1,56 @@
+#print
+In this directory is a file "memo". Between the line
+containing "I." and the line containing "II."
+change all multiple blanks to one blank.
+Then rewrite the file and type "ready".
+#create Ref
+.TL
+The Time Has Come
+.AU
+Joe Idiot
+.AI
+Bell Labs
+Murray Hill, NJ 07974
+.SH
+I. Introduction
+.PP
+This document describes the problems of
+designing complex systems without adequately
+trained manpower. The solution adopted was
+to trick 90% of the staff into thinking they
+were working on the system when in fact they were not.
+This let the remaining 1:0% of the staff actually get
+the thing built.
+.SH
+II. Details
+.PP
+The project began on June 1, 1974. It was completed
+on Sept. 1, 1975 and has worked successfully since then.
+#create memo
+.TL
+The Time Has Come
+.AU
+Joe Idiot
+.AI
+Bell Labs
+Murray Hill, NJ 07974
+.SH
+I. Introduction
+.PP
+This document describes the problems of
+designing complex systems without adequately
+trained manpower. The solution adopted was
+to trick 90% of the staff into thinking they
+were working on the system when in fact they were not.
+This let the remaining 1:0% of the staff actually get
+the thing built.
+.SH
+II. Details
+.PP
+The project began on June 1, 1974. It was completed
+on Sept. 1, 1975 and has worked successfully since then.
+#user
+#cmp memo Ref
+#log
+#next
+53.1a 10
diff --git a/usr.bin/learn/lib/editor/L53.1a b/usr.bin/learn/lib/editor/L53.1a
new file mode 100644
index 00000000000..c3c5a8b0499
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L53.1a
@@ -0,0 +1,22 @@
+#print
+Note that the // searches always go forward.
+Sometimes you want to go backward, to find
+some expression on a line before the
+one you are now working on.
+In that case you can search with a command like
+ ?abc?p
+which prints the nearest preceding line which
+contains 'abc'. What command would print
+the nearest previous line that ends in "cat"?
+Type "answer COMMAND" when you figure it out.
+#copyin
+#user
+#uncopyin
+#match ?cat$?p
+The "p" isn't needed, but use it if you like too.
+#match ?cat$?
+#cmp X1 X2
+#log
+#next
+54.1a 10
+53.2b 7
diff --git a/usr.bin/learn/lib/editor/L53.2b b/usr.bin/learn/lib/editor/L53.2b
new file mode 100644
index 00000000000..f3b131513e3
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L53.2b
@@ -0,0 +1,416 @@
+#print
+There is a big file "federal" in this directory.
+It contains the following mistyped words:
+ Typed as Should be
+cotnend contend
+aalarm alarm
+exedient expedient
+drabel durable
+ugdes judges
+trame trample
+viws views
+
+Fix things up, rewrite the file, and then type "ready".
+#create Ref
+Among the numerous advantages promised by a well-constructed
+Union, none deserves to be more accurately
+developed than its tendency to break and control the violence
+of faction.
+The friend of popular governments never finds himself
+so much alarmed for their character and fate as when he
+contemplates their propensity to this dangerous vice.
+He will not fail, therefore, to set a due value on
+any plan which, without violating the principles to which
+he is attached, provides a proper cure for it.
+The instability, injustice, and confusion introduced into the public
+councils have, in truth, been the mortal diseases under
+which popular governments have everywhere perished, as
+they continue to be the favorite and fruitful topics from
+which the adversaries to liberty derive their most specious
+declamations.
+The valuable improvements made by the American constitutions
+on the popular models, both ancient
+and modern, cannot certainly be too much admired;
+but it would be an unwarrantable partiality to contend
+that they have as effectually obviated the danger on this
+side, as was wished and expected.
+Complaints are everywhere heard from our most considerate and virtuous
+citizens, equally the friends of public and private faith
+and of public and personal liberty, that out governments
+are too unstable, that the public good is disregarded in
+the conflicts of rival parties, and that measures are too
+often decided, not according to the rules of justice and
+the rights of the minor party, but by the superior force
+of an interested and overbearing majority.
+However anxiously we may wish that these complaints had no
+foundation, the evidence of known facts will not permit
+us to deny that they are in some degree true.
+It will be found, indeed, on a candid review of our situation, that
+some of the distresses under which we labor have been
+erroneously charged on the operation of our governments;
+but it will be found, at the same time, that other
+causes will not alone account for many of our heaviest
+misfortunes; and, particularly, for that prevailing and increasing
+distrust of public engagements and alarm for
+private rights which are echoed from one end of the
+continent to the other.
+These must be chiefly, if not wholly,
+effects of the unsteadiness and injustice with
+which a factious spirit has tainted out public administration.
+ By a faction I understand a number of citizens,
+whether amounting to a majority or minority of the whole,
+who are united and actuated by some common impulse
+of passion, or of interest, adverse to the rights of other
+citizens, or to the permanent and aggregate interests of
+the community.
+ There are two methods of curing the mischiefs of
+faction: The one,
+by removing its causes; the other, by controlling
+its effects.
+ There are again two methods of removing the causes of faction:
+The one, by destroying the liberty which is essential to its existence;
+The other, by giving to every
+citizen the same opinions, the same passions, and the
+same interests.
+ It could never be more truly said than of the first
+remedy that it was worse than the disease.
+Liberty is to
+faction what air is to fire, an ailment without which it
+instantly expires.
+But it could not be less folly to
+abolish liberty, which is essential to political life,
+because it nourishes faction than it would be to wish the
+annihilation of air, which is essential to animal life,
+because it imparts to dire its destructive agency.
+ The second expedient is as impracticable as the first
+would be unwise.
+As long as the reason of man continues
+fallible, and he is at liberty to exercise it, different
+opinions will be formed.
+As long as the connection subsists
+between his reason and his self-love, his opinions and his
+passions will have a reciprocal influence on each other;
+and the former will be objects to which the latter will
+attach themselves.
+The diversity in the faculties of men,
+from which the rights of property originate, is not less an
+insuperable obstacle to the uniformity of interests.
+The protection of these faculties is the first object of
+government.
+From the protection of different and unequal
+faculties of acquiring property, the possession of
+different degrees and kinds of property immediately results;
+and from the influence of these on the sentiments and views
+of the respective proprietors ensues a division of the
+society into different interests and parties.
+ The latent causes of faction are thus sown in the
+nature of man; and we see them everywhere brought
+into different degrees of activity, according to the
+different circumstances of civil society.
+A zeal for different opinions
+concerning religion, concerning government, and
+many other points, as well of speculation as of practice;
+an attachment to different leaders ambitiously contending
+for pre-eminence and power; or to persons of other
+descriptions whose fortunes have been interesting to the
+human passions, have, in turn, divided mankind into
+parties, inflamed them with mutual animosity, and
+rendered them much more disposed to vex and oppress each
+other than to co-operate for their common goal.
+So strong is this propensity of mankind to fall into mutual
+animosities that where no substantial occasion presents
+itself the most frivolous and fanciful distinctions have
+been sufficient to kindle their unfriendly passions and
+excite their most violent conflicts.
+But the most common and durable
+source of factions has been the verious
+and unequal distribution of property.
+Those who hold and those who are without
+property have ever formed distinct
+interests in society.
+Those who are creditors, and those
+who are debtors, fall under a like discrimination.
+A landed interest, a manufacturing interest,
+a mercantile interest, a moneyed interest,
+with many lesser interests, grow up of
+necessity in civilized nations, and divided them into
+different classes, actuated by different sentiments and views.
+The regulation of these various and interfering interests
+involves the spirit of party and faction in the necessary
+and ordinary operations of government.
+ No man is allowed to be a judge in has own cause,
+because his interest would certainly bias his judgement,
+and, not improbably, corrupt his integrity.
+With equal, nay with greater reason, a body
+of men are unfit to be both judges and parties at the same time;
+yet what are many of the most important acts of
+legislation but so many judicial determinations,
+not indeed concerning the
+rights of single person, but concerning the rights of large
+bodies of citizens?
+And what are the different classes of legislators but
+advocates and parties to the causes which
+they determine?
+Is a law proposed concerning private
+debts?
+It is a question to which the creditors are parties
+one one side and the debtors on the other.
+Justice ought to hold the balance
+between them.
+Yet the parties are, and must be,
+themselves the judges; and the most numerous
+party, or in other words, the most powerful faction must
+be expected to prevail.
+Shall domestic manufacturers be
+encouraged, and in what degree, by restrictions on foreign
+manufacturers?
+are questions which would be differently
+decided by the landed and the manufacturing classes, and
+probably by neither with a sole regard to justice and the
+public good.
+The apportionment of taxes on the various
+descriptions of property is an act which seems to require
+the most exact impartiality; yet there is, perhaps, no
+legislative act in which greater opportunity and
+temptation are given to a predominant party to trample on the
+rules of justice.
+Every shilling with which they overburden the inferior
+number is a shilling saved to their own pockets.
+ It is in vain to say that enlightened statesmen will be
+able to adjust these clashing interests and render them
+all subservient to the public good.
+Enlightened statesmen will not
+always be at the helm.
+Nor, in many cases, can
+such an adjustment be made at all without taking into
+view indirect and remote considerations, which will rarely
+prevail over the immediate interest which one party may
+find in disregarding the rights of another or the good of
+the whole.
+ The inference to which we are brought is that the causes
+of faction cannot be removed and that relief is only to be
+sought in the means of controlling its effects.
+ If a faction consists of less than a majority, relief is
+supplied by the republican principle, which enables the
+majority to defeat its sinister views by regular vote.
+It may clog the administration, it may convulse the society;
+But it will be unable to execute and mask its violence
+under the forms of the Constitution.
+When a majority is included in a faction,
+The form of popular government, on
+the other hand, enables it to sacrifice to its ruling passion
+or interest both the public good and the rights of other
+citizens.
+To secure the public good and private rights
+against the danger of such a faction, and at the same
+time to preserve the spirit and form of popular
+government, is than the great object to which our inquiries
+are directed.
+Let me add that it is the great desideratum by which
+alone this form of government can be rescued from
+the opprobrium under which it has so long labored and
+be recommended to the esteem and adoption of mankind.
+#create federal
+Among the numerous advantages promised by a well-constructed
+Union, none deserves to be more accurately
+developed than its tendency to break and control the violence
+of faction.
+The friend of popular governments never finds himself
+so much alarmed for their character and fate as when he
+contemplates their propensity to this dangerous vice.
+He will not fail, therefore, to set a due value on
+any plan which, without violating the principles to which
+he is attached, provides a proper cure for it.
+The instability, injustice, and confusion introduced into the public
+councils have, in truth, been the mortal diseases under
+which popular governments have everywhere perished, as
+they continue to be the favorite and fruitful topics from
+which the adversaries to liberty derive their most specious
+declamations.
+The valuable improvements made by the American constitutions
+on the popular models, both ancient
+and modern, cannot certainly be too much admired;
+but it would be an unwarrantable partiality to cotnend
+that they have as effectually obviated the danger on this
+side, as was wished and expected.
+Complaints are everywhere heard from our most considerate and virtuous
+citizens, equally the friends of public and private faith
+and of public and personal liberty, that out governments
+are too unstable, that the public good is disregarded in
+the conflicts of rival parties, and that measures are too
+often decided, not according to the rules of justice and
+the rights of the minor party, but by the superior force
+of an interested and overbearing majority.
+However anxiously we may wish that these complaints had no
+foundation, the evidence of known facts will not permit
+us to deny that they are in some degree true.
+It will be found, indeed, on a candid review of our situation, that
+some of the distresses under which we labor have been
+erroneously charged on the operation of our governments;
+but it will be found, at the same time, that other
+causes will not alone account for many of our heaviest
+misfortunes; and, particularly, for that prevailing and increasing
+distrust of public engagements and aalarm for
+private rights which are echoed from one end of the
+continent to the other.
+These must be chiefly, if not wholly,
+effects of the unsteadiness and injustice with
+which a factious spirit has tainted out public administration.
+ By a faction I understand a number of citizens,
+whether amounting to a majority or minority of the whole,
+who are united and actuated by some common impulse
+of passion, or of interest, adverse to the rights of other
+citizens, or to the permanent and aggregate interests of
+the community.
+ There are two methods of curing the mischiefs of
+faction: The one,
+by removing its causes; the other, by controlling
+its effects.
+ There are again two methods of removing the causes of faction:
+The one, by destroying the liberty which is essential to its existence;
+The other, by giving to every
+citizen the same opinions, the same passions, and the
+same interests.
+ It could never be more truly said than of the first
+remedy that it was worse than the disease.
+Liberty is to
+faction what air is to fire, an ailment without which it
+instantly expires.
+But it could not be less folly to
+abolish liberty, which is essential to political life,
+because it nourishes faction than it would be to wish the
+annihilation of air, which is essential to animal life,
+because it imparts to dire its destructive agency.
+ The second exedient is as impracticable as the first
+would be unwise.
+As long as the reason of man continues
+fallible, and he is at liberty to exercise it, different
+opinions will be formed.
+As long as the connection subsists
+between his reason and his self-love, his opinions and his
+passions will have a reciprocal influence on each other;
+and the former will be objects to which the latter will
+attach themselves.
+The diversity in the faculties of men,
+from which the rights of property originate, is not less an
+insuperable obstacle to the uniformity of interests.
+The protection of these faculties is the first object of
+government.
+From the protection of different and unequal
+faculties of acquiring property, the possession of
+different degrees and kinds of property immediately results;
+and from the influence of these on the sentiments and views
+of the respective proprietors ensues a division of the
+society into different interests and parties.
+ The latent causes of faction are thus sown in the
+nature of man; and we see them everywhere brought
+into different degrees of activity, according to the
+different circumstances of civil society.
+A zeal for different opinions
+concerning religion, concerning government, and
+many other points, as well of speculation as of practice;
+an attachment to different leaders ambitiously contending
+for pre-eminence and power; or to persons of other
+descriptions whose fortunes have been interesting to the
+human passions, have, in turn, divided mankind into
+parties, inflamed them with mutual animosity, and
+rendered them much more disposed to vex and oppress each
+other than to co-operate for their common goal.
+So strong is this propensity of mankind to fall into mutual
+animosities that where no substantial occasion presents
+itself the most frivolous and fanciful distinctions have
+been sufficient to kindle their unfriendly passions and
+excite their most violent conflicts.
+But the most common and drabel
+source of factions has been the verious
+and unequal distribution of property.
+Those who hold and those who are without
+property have ever formed distinct
+interests in society.
+Those who are creditors, and those
+who are debtors, fall under a like discrimination.
+A landed interest, a manufacturing interest,
+a mercantile interest, a moneyed interest,
+with many lesser interests, grow up of
+necessity in civilized nations, and divided them into
+different classes, actuated by different sentiments and views.
+The regulation of these various and interfering interests
+involves the spirit of party and faction in the necessary
+and ordinary operations of government.
+ No man is allowed to be a judge in has own cause,
+because his interest would certainly bias his judgement,
+and, not improbably, corrupt his integrity.
+With equal, nay with greater reason, a body
+of men are unfit to be both ugdes and parties at the same time;
+yet what are many of the most important acts of
+legislation but so many judicial determinations,
+not indeed concerning the
+rights of single person, but concerning the rights of large
+bodies of citizens?
+And what are the different classes of legislators but
+advocates and parties to the causes which
+they determine?
+Is a law proposed concerning private
+debts?
+It is a question to which the creditors are parties
+one one side and the debtors on the other.
+Justice ought to hold the balance
+between them.
+Yet the parties are, and must be,
+themselves the judges; and the most numerous
+party, or in other words, the most powerful faction must
+be expected to prevail.
+Shall domestic manufacturers be
+encouraged, and in what degree, by restrictions on foreign
+manufacturers?
+are questions which would be differently
+decided by the landed and the manufacturing classes, and
+probably by neither with a sole regard to justice and the
+public good.
+The apportionment of taxes on the various
+descriptions of property is an act which seems to require
+the most exact impartiality; yet there is, perhaps, no
+legislative act in which greater opportunity and
+temptation are given to a predominant party to trame on the
+rules of justice.
+Every shilling with which they overburden the inferior
+number is a shilling saved to their own pockets.
+ It is in vain to say that enlightened statesmen will be
+able to adjust these clashing interests and render them
+all subservient to the public good.
+Enlightened statesmen will not
+always be at the helm.
+Nor, in many cases, can
+such an adjustment be made at all without taking into
+view indirect and remote considerations, which will rarely
+prevail over the immediate interest which one party may
+find in disregarding the rights of another or the good of
+the whole.
+ The inference to which we are brought is that the causes
+of faction cannot be removed and that relief is only to be
+sought in the means of controlling its effects.
+ If a faction consists of less than a majority, relief is
+supplied by the republican principle, which enables the
+majority to defeat its sinister viws by regular vote.
+It may clog the administration, it may convulse the society;
+But it will be unable to execute and mask its violence
+under the forms of the Constitution.
+When a majority is included in a faction,
+The form of popular government, on
+the other hand, enables it to sacrifice to its ruling passion
+or interest both the public good and the rights of other
+citizens.
+To secure the public good and private rights
+against the danger of such a faction, and at the same
+time to preserve the spirit and form of popular
+government, is than the great object to which our inquiries
+are directed.
+Let me add that it is the great desideratum by which
+alone this form of government can be rescued from
+the opprobrium under which it has so long labored and
+be recommended to the esteem and adoption of mankind.
+#user
+#cmp federal Ref
+#log
+#next
+54.1a 10
diff --git a/usr.bin/learn/lib/editor/L54.1a b/usr.bin/learn/lib/editor/L54.1a
new file mode 100644
index 00000000000..d813f6e2841
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L54.1a
@@ -0,0 +1,40 @@
+#print
+A time-saving feature of context searches is
+that the editor remembers the last regular expression
+mentioned, and if you just say // or ??
+with no expression, it assumes the same one. Thus
+ /abc/s//def/
+searches for a line with 'abc', and, on finding it,
+changes the 'abc' to 'def'. Similarly
+ /qqq/s///
+finds a 'qqq' and then throws it away, as if the
+command were
+ /qqq/s/qqq//
+In this directory is a file 'error' which contains
+"servixe" as a mistyping for "service". Find
+the bad instance and fix it, if possible with one command.
+Then rewrite the file and type 'ready'.
+#create Ref
+This file contains many copies
+of the word service
+but in all of those lines
+with service in them
+the next line has a
+service that is spelled
+wrong unlike the other
+services.
+#create error
+This file contains many copies
+of the word service
+but in all of those lines
+with service in them
+the next line has a
+servixe that is spelled
+wrong unlike the other
+services.
+#user
+#cmp error Ref
+#log
+#next
+55.1a 10
+54.1b 8
diff --git a/usr.bin/learn/lib/editor/L54.1b b/usr.bin/learn/lib/editor/L54.1b
new file mode 100644
index 00000000000..0f90c390660
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L54.1b
@@ -0,0 +1,43 @@
+#print
+The fact that the system remembers the last regular expression
+it had is particularly useful when the regular expression is
+complex. Suppose, for example, you know that the
+words "first" and "second" appear on the same line and you wish
+to delete them and everything between them. You could write
+ /first.*second/s/first.*second//p
+but isn't it easier to do
+ /first.*second/s///p
+Edit the file "passage"; the words "twentieth" and "impending" appear
+on the same line. Replace them and everything between
+them by the word "impending" (i.e. delete from "twentieth"
+up to but not including "impending"). One command, if you can.
+Then rewrite the file and type ready.
+#create Ref
+ America's rise to world power is a consequence of the nation's
+geographic position, natural resources, and dynamic energy. For
+the first century and more of national history, however, continental
+expansion and internal developments largely absorbed the energies
+of the American people. Every dictate of public interest emphasized
+the importance of avoiding all entanglements that might involve the
+young republic in foreign rivalries and foreign wars. Only with the
+impending shifts
+in the European balance of power, and the growth of American economic
+and industrial strength create a situation that made impossible a
+continued aloofness from international affairs.
+#create passage
+ America's rise to world power is a consequence of the nation's
+geographic position, natural resources, and dynamic energy. For
+the first century and more of national history, however, continental
+expansion and internal developments largely absorbed the energies
+of the American people. Every dictate of public interest emphasized
+the importance of avoiding all entanglements that might involve the
+young republic in foreign rivalries and foreign wars. Only with the
+twentieth century did a rapidly contracting world, impending shifts
+in the European balance of power, and the growth of American economic
+and industrial strength create a situation that made impossible a
+continued aloofness from international affairs.
+#user
+#cmp passage Ref
+#log
+#next
+55.1a 10
diff --git a/usr.bin/learn/lib/editor/L55.1a b/usr.bin/learn/lib/editor/L55.1a
new file mode 100644
index 00000000000..56c8fe59fff
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L55.1a
@@ -0,0 +1,34 @@
+#print
+This is an easy unit. If you just hit
+"newline" (or "carriage return", whatever it
+is labeled on your terminal), the
+editor will simply print the next line
+as you can see by trying this out. Edit the
+file "pres"; print some line; then hit return
+or newline, and watch the editor print the
+next line. Is there any difference between
+newline and ".+1p" as a command? When you
+think you know, leave the editor and type "yes" or "no".
+#create pres
+George Washington
+John Adams
+Thomas Jefferson
+James Madison
+James Monroe
+John Quincy Adams
+Andrew Jackson
+Martin van Buren
+William Henry Harrison
+John Tyler
+James K. Polk
+Franklin Pierce
+Millard Fillmore
+James Buchanan
+Abraham Lincoln
+#copyin
+#user
+#uncopyin
+#match no
+#log
+#next
+56.1a 10
diff --git a/usr.bin/learn/lib/editor/L56.1a b/usr.bin/learn/lib/editor/L56.1a
new file mode 100644
index 00000000000..6ac814f95ae
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L56.1a
@@ -0,0 +1,37 @@
+#print
+Is there just as easy a way of
+printing the immediately preceding line?
+Not quite, but almost. The line
+
+-
+
+will print the line just before the line you
+are on. What's the equivalent command
+in terms of "." and "p"? Type "answer COMMAND"
+when you figure it out. Again, you can experiment
+first; the same file named "pres" is in this directory.
+#create pres
+George Washington
+John Adams
+Thomas Jefferson
+James Madison
+James Monroe
+John Quincy Adams
+Andrew Jackson
+Martin van Buren
+William Henry Harrison
+John Tyler
+James K. Polk
+Franklin Pierce
+Millard Fillmore
+James Buchanan
+Abraham Lincoln
+#copyin
+#user
+#uncopyin
+#match .-1p
+The "p" isn't needed.
+#match .-1
+#log
+#next
+57.1a 10
diff --git a/usr.bin/learn/lib/editor/L57.1a b/usr.bin/learn/lib/editor/L57.1a
new file mode 100644
index 00000000000..c03026f985c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L57.1a
@@ -0,0 +1,48 @@
+#print
+For symmetry, you can use
+
++
+
+instead of either ".+1p" or an empty
+line (just a newline). The only advantage
+that + has is that you can repeat it:
+
+++
+
+prints the second following line, and
+
++++
+
+the third. The same is true of -.
+If the current line is line number 10,
+what line number is -- going to be?
+(Hint: you can find out by editing a file
+such as "pres", saying "10p", and then
+saying "--", and then saying ".=" - remember
+the "=" command?)
+When you find out, type "answer N" where
+N is the number.
+#create pres
+George Washington
+John Adams
+Thomas Jefferson
+James Madison
+James Monroe
+John Quincy Adams
+Andrew Jackson
+Martin van Buren
+William Henry Harrison
+John Tyler
+James K. Polk
+Franklin Pierce
+Millard Fillmore
+James Buchanan
+Abraham Lincoln
+#copyin
+#user
+#uncopyin
+#match 8
+#log
+#next
+60.1a 10
+60.2a 5
diff --git a/usr.bin/learn/lib/editor/L6.1a b/usr.bin/learn/lib/editor/L6.1a
new file mode 100644
index 00000000000..0e697aa59f1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L6.1a
@@ -0,0 +1,41 @@
+#print
+You may well ask how the editor knows which line to print.
+The editor keeps track of the 'current line', which
+is usually the last line you touched in any way.
+When you begin editing a file, for example, the
+current line is the last line.
+If you want to print any particular line, however,
+that is easy. For example, to print the 3rd line you say
+
+3p
+
+To print the first line
+
+1p
+
+(That's a one, no matter how much it looks like the letter "l".)
+Here is a file: I'll put you into the editor
+with that file as the 'current file' - print the 4th line,
+then type 'w', 'q', and 'ready' as usual.
+#create Ref
+james madison
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#print file
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X2
+#cmp Ref X2
+#log
+#next
+7.1a 10
diff --git a/usr.bin/learn/lib/editor/L6.2a b/usr.bin/learn/lib/editor/L6.2a
new file mode 100644
index 00000000000..4df8247c58b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L6.2a
@@ -0,0 +1,40 @@
+#print
+How does the editor choose a line to print?
+It always remembers a 'current line', which
+is the last line of the file originally,
+but you can choose any line you want. The command
+
+3p
+
+prints the third line of the file, for example.
+And
+
+1p
+
+prints the first line. Note that is the digit one
+there, not the letter l, no matter how much alike they
+look. I'll put you into the editor with the
+file listed below: print the first line,
+then type 'w', 'q' and 'ready' as usual.
+#create Ref
+george washington
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#print file
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X2
+#cmp Ref X2
+#log
+#next
+6.2b 5
diff --git a/usr.bin/learn/lib/editor/L6.2b b/usr.bin/learn/lib/editor/L6.2b
new file mode 100644
index 00000000000..2c4799682df
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L6.2b
@@ -0,0 +1,26 @@
+#print
+Same thing again, but this time print the
+fifth line in the file. Then type "w", "q",
+and "ready".
+#create Ref
+james monroe
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#print file
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X2
+#cmp Ref X2
+#log
+#next
+7.1a 10
diff --git a/usr.bin/learn/lib/editor/L60.1a b/usr.bin/learn/lib/editor/L60.1a
new file mode 100644
index 00000000000..78874c87410
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.1a
@@ -0,0 +1,61 @@
+#print
+So far you have always dealt with one file at a time.
+Suppose you wanted to combine two files - there is nothing
+we have covered so far that will do that. But the
+editor does have a command 'r' (read)
+
+r file
+
+which reads in the contents of "file" without throwing
+away what you already have. So that you can combine
+the files "cat" and "dog" (and name the result "animal")
+by saying
+
+ed
+r cat
+r dog
+w animal
+q
+
+In this directory are four files named
+for continents. Combine them into
+one file named "world".
+(Read the files in alphabetical order,
+as they are listed). You may want to list
+the input files and the combined files
+with "cat" to see what they look like.
+When done, type "ready" as usual.
+#create Ref
+This is file
+'africa' and will be listed first.
+------
+this file will
+have to do
+for both american
+continents
+-----
+ File "asia"
+ is indented
+ two spaces.
+Europe's file is only one line long.
+#create africa
+This is file
+'africa' and will be listed first.
+#create america
+------
+this file will
+have to do
+for both american
+continents
+-----
+#create asia
+ File "asia"
+ is indented
+ two spaces.
+#create europe
+Europe's file is only one line long.
+#user
+#cmp Ref world
+#log
+#next
+60.1b 10
diff --git a/usr.bin/learn/lib/editor/L60.1b b/usr.bin/learn/lib/editor/L60.1b
new file mode 100644
index 00000000000..b990cc6b51a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.1b
@@ -0,0 +1,78 @@
+#print
+You can, of course, use the 'r' command
+with an address. Any editor command can be used
+with an address (except 'q'). For example, there
+is a file 'phone' in this directory.
+If you print it, you'll see that one department
+is missing from the list; it is on file 'filler'.
+Edit 'phone'; read in 'filler' after the line
+saying '1273'. Then rewrite 'phone', leave the
+editor, and say "ready".
+#create Ref
+ telephone numbers
+
+Department 1271
+McIlroy M D ext 6050
+Aho A V ext 4862
+Baker B S ext 6503
+Cherry L L ext 6067
+Knowlton K ext 2328
+Morris R ext 3878
+Ossanna J F ext 3520
+Thompson K ext 2394
+
+Department 1273
+Pinson E N ext 2582
+Bourne S R ext 7419
+Elliot R J ext 2879
+Fraser A G ext 3685
+Johnson S C ext 3968
+Kernighan B W ext 6021
+Ritchie D M ext 3770
+Vollaro J R ext 6321
+
+Department 1274
+Brown W S ext 4822
+Blue J L ext 6558
+Feldman S I ext 2059
+Hall A D ext 4006
+Lesk M E ext 6377
+Schryer N L ext 2912
+Warner D D ext 2833
+#create filler
+Pinson E N ext 2582
+Bourne S R ext 7419
+Elliot R J ext 2879
+Fraser A G ext 3685
+Johnson S C ext 3968
+Kernighan B W ext 6021
+Ritchie D M ext 3770
+Vollaro J R ext 6321
+#create phone
+ telephone numbers
+
+Department 1271
+McIlroy M D ext 6050
+Aho A V ext 4862
+Baker B S ext 6503
+Cherry L L ext 6067
+Knowlton K ext 2328
+Morris R ext 3878
+Ossanna J F ext 3520
+Thompson K ext 2394
+
+Department 1273
+
+Department 1274
+Brown W S ext 4822
+Blue J L ext 6558
+Feldman S I ext 2059
+Hall A D ext 4006
+Lesk M E ext 6377
+Schryer N L ext 2912
+Warner D D ext 2833
+#user
+#cmp phone Ref
+#log
+#next
+61.1a 10
diff --git a/usr.bin/learn/lib/editor/L60.2a b/usr.bin/learn/lib/editor/L60.2a
new file mode 100644
index 00000000000..e62296038fc
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.2a
@@ -0,0 +1,60 @@
+#print
+Suppose you wanted to combine two files? No editor command you
+have learned so far will do that. The command 'r' is just what the doctor
+ordered. It reads in a file, without throwing away the existing buffer.
+So, for example,
+ ed para1
+ r para2
+ w both
+ q
+will edit "para1"; then read in "para2" at the end; and then
+write the combined stuff on "both". Try that, with those names,
+in this directory. Then type "ready".
+#create Ref
+ We say that matter is anything which occupies space and has
+weight. Matter possesses inertia, which is a resistance to change
+of position or motion. It may be acted on by forces which may set
+it in motion, or change its motion. While all these statements
+are descriptive of matter, they do not provide us with a completely
+satisfactory definition. Scientists, with their great knowledge
+of the properties and behavior of matter, are not yet able to
+define it precisely. Nature still holds many secrets to challenge
+the minds of men.
+ The quantity of matter which a body possesses is known as its
+mass.
+ When one end of a long glass tube that is open at both ends is
+placed in water, forces cause the water to rise in the tube to a
+certain height. The finer the bore of the tube, the higher the
+water rises. A tube with a hairlike bore is called a capillary
+tube and the liquid rise in it is called capillarity. How could
+you show that this rise is not due to atmospheric pressure?
+ Seemingly, water rises in capillary tubes because the adhesive
+forces between glass and water molecules are greater than the cohesive
+forces between water molecules.
+#create para1
+ We say that matter is anything which occupies space and has
+weight. Matter possesses inertia, which is a resistance to change
+of position or motion. It may be acted on by forces which may set
+it in motion, or change its motion. While all these statements
+are descriptive of matter, they do not provide us with a completely
+satisfactory definition. Scientists, with their great knowledge
+of the properties and behavior of matter, are not yet able to
+define it precisely. Nature still holds many secrets to challenge
+the minds of men.
+ The quantity of matter which a body possesses is known as its
+mass.
+#create para2
+ When one end of a long glass tube that is open at both ends is
+placed in water, forces cause the water to rise in the tube to a
+certain height. The finer the bore of the tube, the higher the
+water rises. A tube with a hairlike bore is called a capillary
+tube and the liquid rise in it is called capillarity. How could
+you show that this rise is not due to atmospheric pressure?
+ Seemingly, water rises in capillary tubes because the adhesive
+forces between glass and water molecules are greater than the cohesive
+forces between water molecules.
+#user
+#cmp both Ref
+#log
+#next
+60.2b 5
diff --git a/usr.bin/learn/lib/editor/L60.2b b/usr.bin/learn/lib/editor/L60.2b
new file mode 100644
index 00000000000..f98b9ea995c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.2b
@@ -0,0 +1,109 @@
+#print
+You can of course combine many files. Make a file
+"total" which contains the pieces "first", "second",
+"third", and "fourth" in that order. Then type "ready".
+#create Ref
+ It has been already observed that the federal government
+ought to possess the power of providing for the support
+of the national forces; in which proposition was intended
+to be included the expense of raising troops, of building
+and equipping fleets, and all other expenses in any wise
+connected with military arrangements and operations. But
+these are not the only objects to which the jurisdiction of
+the Union in respect to revenue must necessarily be empowered
+to extend. It must embrace a provision for the
+support of the national civil list; for the payment of the
+national debts contracted, or that may be contracted;
+and, in general, for all those matters which will call for
+disbursements out of the national treasury. The conclusion
+is that there must be interwoven in the frame of the
+government a general power of taxation, in one shape or
+another.
+ Money is, with propriety, considered as the vital principle
+of the body politic; as that which sustains its life and
+motion and enables it to perform its most essential functions.
+A complete power, therefore, to procure a regular
+and adequate supply of revenue, as far as the resources
+of the community will permit, may be regarded
+as an indispensable ingredient in every constitution.
+From a deficiency in this particular, one of two evils
+must ensue: either the people must be subjected to
+continual plunder, as a substitute for a more eligible
+mode of supplying the public wants, or the government
+must sink into a fatal atrophy, and, in a short course of
+time, perish.
+ In the Ottoman or Turkish empire the sovereign,
+though in other respects absolute master of the lives and
+fortunes of his subjects, has no right to impose a new tax.
+The consequence is that he permits the bashaws or governors
+of provinces to pillage the people at discretion,
+and, in turn, squeezes out of them the sums of which he
+stands in need to satisfy his own exigencies and those of
+the state. In America, from a like cause, the government
+of the Union has gradually dwindled into a state of decay,
+approaching nearly to annihilation. Who can doubt that
+the happiness of the people in both countries would be
+promoted by competent authorities in the proper hands
+to provide the revenues which the necessities of the public
+might require?
+ The present Confederation, feeble as it is, intended to
+repose in the United States an unlimited power of providing
+for the pecuniary wants of the Union. But proceeding
+upon an erroneous principle, it has been done in
+such a manner as entirely to have frustrated the intention.
+#create first
+ It has been already observed that the federal government
+ought to possess the power of providing for the support
+of the national forces; in which proposition was intended
+to be included the expense of raising troops, of building
+and equipping fleets, and all other expenses in any wise
+connected with military arrangements and operations. But
+these are not the only objects to which the jurisdiction of
+the Union in respect to revenue must necessarily be empowered
+to extend. It must embrace a provision for the
+support of the national civil list; for the payment of the
+national debts contracted, or that may be contracted;
+and, in general, for all those matters which will call for
+disbursements out of the national treasury. The conclusion
+is that there must be interwoven in the frame of the
+government a general power of taxation, in one shape or
+another.
+#create fourth
+ The present Confederation, feeble as it is, intended to
+repose in the United States an unlimited power of providing
+for the pecuniary wants of the Union. But proceeding
+upon an erroneous principle, it has been done in
+such a manner as entirely to have frustrated the intention.
+#create second
+ Money is, with propriety, considered as the vital principle
+of the body politic; as that which sustains its life and
+motion and enables it to perform its most essential functions.
+A complete power, therefore, to procure a regular
+and adequate supply of revenue, as far as the resources
+of the community will permit, may be regarded
+as an indispensable ingredient in every constitution.
+From a deficiency in this particular, one of two evils
+must ensue: either the people must be subjected to
+continual plunder, as a substitute for a more eligible
+mode of supplying the public wants, or the government
+must sink into a fatal atrophy, and, in a short course of
+time, perish.
+#create third
+ In the Ottoman or Turkish empire the sovereign,
+though in other respects absolute master of the lives and
+fortunes of his subjects, has no right to impose a new tax.
+The consequence is that he permits the bashaws or governors
+of provinces to pillage the people at discretion,
+and, in turn, squeezes out of them the sums of which he
+stands in need to satisfy his own exigencies and those of
+the state. In America, from a like cause, the government
+of the Union has gradually dwindled into a state of decay,
+approaching nearly to annihilation. Who can doubt that
+the happiness of the people in both countries would be
+promoted by competent authorities in the proper hands
+to provide the revenues which the necessities of the public
+might require?
+#user
+#cmp total Ref
+#next
+60.2c 5
diff --git a/usr.bin/learn/lib/editor/L60.2c b/usr.bin/learn/lib/editor/L60.2c
new file mode 100644
index 00000000000..488a3b0f99e
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.2c
@@ -0,0 +1,57 @@
+#print
+You can use an address on the 'r' command to read input at a particular
+location in the file. Thus
+ 5r name
+reads file "name" and appends its contents after line 5 o f the file.
+You can use any kind of address, including a search. Here is a file "chem".
+Find the line in file "chem" which contains the word "eight";
+read the file "more" and append it after that line. Then rewrite
+"chem" and type "ready".
+#create Ref
+ When elements combine to form compounds, the electrons in the
+outermost shell of the atoms are the only ones that take part in the
+reaction. These electrons are either transferred from the outer
+shell of one atom to the outer shell of another, or, in some cases,
+shared with the electrons in the outer shell of the second atom.
+ Whether the electrons are transfered to the second atom or shared,
+this atom completes its quota of eight electrons in the outer shell.
+ An oxide is a compound containing oxygen and one other element.
+The simplest of the oxides is H2O -- pure water, or hydrogen oxide.
+Carbon dioxide is CO2 and is formed during the burning of organic
+matter such as wood, paper, gasoline, or coal. In the same burning
+process, H2O is formed and energy is released, generally as heat,
+sometimes as light. Carbon dioxide is in the breath you just
+exhaled. This gas is given off by decaying plant and animal matter.
+Decay is a burning process.
+ Oxidation is a word that covers all the different ways things
+burn. When something oxidizes, it is burning.
+ Compounds which are formed by the interchange of electrons are
+called ionic compounds. The ions formed are said to possess
+electrovalence.
+#create chem
+ When elements combine to form compounds, the electrons in the
+outermost shell of the atoms are the only ones that take part in the
+reaction. These electrons are either transferred from the outer
+shell of one atom to the outer shell of another, or, in some cases,
+shared with the electrons in the outer shell of the second atom.
+ Whether the electrons are transfered to the second atom or shared,
+this atom completes its quota of eight electrons in the outer shell.
+ Compounds which are formed by the interchange of electrons are
+called ionic compounds. The ions formed are said to possess
+electrovalence.
+#create more
+ An oxide is a compound containing oxygen and one other element.
+The simplest of the oxides is H2O -- pure water, or hydrogen oxide.
+Carbon dioxide is CO2 and is formed during the burning of organic
+matter such as wood, paper, gasoline, or coal. In the same burning
+process, H2O is formed and energy is released, generally as heat,
+sometimes as light. Carbon dioxide is in the breath you just
+exhaled. This gas is given off by decaying plant and animal matter.
+Decay is a burning process.
+ Oxidation is a word that covers all the different ways things
+burn. When something oxidizes, it is burning.
+#user
+#cmp chem Ref
+#log
+#next
+60.2d 5
diff --git a/usr.bin/learn/lib/editor/L60.2d b/usr.bin/learn/lib/editor/L60.2d
new file mode 100644
index 00000000000..8a178761c9c
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L60.2d
@@ -0,0 +1,52 @@
+#print
+This is trickier. Read the file "text". Look for a line saying
+"insert file ... here". Delete that line, and in its
+place (after the preceding line) read in the file asked for.
+Then rewrite "text" and type "ready".
+#create Ref
+ The severity of the judicial and penal system was partly
+caused by the defects of the police. Only a small proportion of
+criminals were caught, and even when arrests were made, but little
+evidence was collected. The officers, so far from being scientific
+were not even properly professional. For although the constable of
+each village and the watchman of each town were paid to guard peace
+land property, they were yet neither specially fitted nor trained
+for that employment. In a country village the case was even worse.
+For there the magistrates could only afford to hire the part-service
+of a farmer-constable.
+ It is a striking fact that until recently democracy never
+flourished except in very small states -- for the most part in cities.
+It is true that in both the Persian and the Roman empires a measure
+of self-government was accorded to local communities, but only in
+respect to purely local affairs; in no large state as a whole was
+democratic government found to be practicable. One essential reason
+is that until recently the means of communication were too slow and
+uncertain to create the necessary solidarity of interest and similarity
+of information over large areas.
+#create inside
+land property, they were yet neither specially fitted nor trained
+for that employment. In a country village the case was even worse.
+For there the magistrates could only afford to hire the part-service
+of a farmer-constable.
+ It is a striking fact that until recently democracy never
+flourished except in very small states -- for the most part in cities.
+It is true that in both the Persian and the Roman empires a measure
+of self-government was accorded to local communities, but only in
+#create text
+ The severity of the judicial and penal system was partly
+caused by the defects of the police. Only a small proportion of
+criminals were caught, and even when arrests were made, but little
+evidence was collected. The officers, so far from being scientific
+were not even properly professional. For although the constable of
+each village and the watchman of each town were paid to guard peace
+ *** insert file "inside" here ***
+respect to purely local affairs; in no large state as a whole was
+democratic government found to be practicable. One essential reason
+is that until recently the means of communication were too slow and
+uncertain to create the necessary solidarity of interest and similarity
+of information over large areas.
+#user
+#cmp text Ref
+#log
+#next
+61.1a 10
diff --git a/usr.bin/learn/lib/editor/L61.1a b/usr.bin/learn/lib/editor/L61.1a
new file mode 100644
index 00000000000..407be4366c0
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L61.1a
@@ -0,0 +1,27 @@
+#print
+Note that usually you just type 'w' without a file name,
+and the editor buffer is written on the 'current file'.
+What is the 'current file' when you have executed an 'r'
+command? Well, it doesn't change. But rather than
+be in doubt, there is a command
+ f
+which prints the current file name.
+You can change the current file name with
+ f name
+so that you can copy file 'old' to 'new' with
+ ed old
+ f new
+ w
+ q
+Try that: copy file 'first' to 'second' in this
+directory. Then type "ready".
+#create first
+This is the
+file to be copied
+using the 'f' command.
+#user
+#cmp first second
+#log
+#next
+62.1a 10
+62.2a 5
diff --git a/usr.bin/learn/lib/editor/L62.1a b/usr.bin/learn/lib/editor/L62.1a
new file mode 100644
index 00000000000..4b8eb903793
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L62.1a
@@ -0,0 +1,67 @@
+#print
+Frequently you will want to move one or more lines
+from one place in a file to another. The command
+
+5,10m30
+
+will pick up lines 5 through 10 and move them after line 30.
+You can of course use context searches for addresses:
+
+/ab/,/cd/m/xx/
+
+finds a line containing "ab", then one containing "cd",
+and moves the section of the file they bracket after the
+next line containing "xx".
+Or you can use ".", "$", etc.:
+
+.,.+2m$
+
+moves the three lines starting at "." to the end.
+
+There is a file "word" which
+is out of order; re-arrange it to be alphabetical.
+#create Ref
+bands
+becomes
+course
+dissolve
+events
+for
+have
+human
+in
+it
+necessary
+of
+one
+people
+political
+the
+to
+when
+which
+#create word
+bands
+becomes
+course
+in
+it
+necessary
+of
+one
+people
+political
+dissolve
+events
+for
+have
+human
+the
+to
+when
+which
+#user
+#cmp word Ref
+#log
+#next
+63.1a 10
diff --git a/usr.bin/learn/lib/editor/L62.2a b/usr.bin/learn/lib/editor/L62.2a
new file mode 100644
index 00000000000..553438a11d4
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L62.2a
@@ -0,0 +1,59 @@
+#print
+A very useful command in the UNIX editor
+is the 'm' command, which moves a lot of
+lines from one place to another in a file. For example,
+ 5,10m20
+picks up lines 5 through 10 and moves them after line 20. Try
+that on the file "list" in this directory: move lines 5 to 10 after
+line 20, rewrite the file, and type "ready".
+#create Ref
+ computer languages
+
+fortran
+cobol
+snobol
+comit
+lex
+yacc
+c
+tmg
+ratfor
+basic
+bon
+bcpl
+algol 60
+algol 68
+pl/i
+pl/c
+pl/360
+apl
+altran
+formac
+#create list
+ computer languages
+
+fortran
+cobol
+algol 60
+algol 68
+pl/i
+pl/c
+pl/360
+apl
+snobol
+comit
+lex
+yacc
+c
+tmg
+ratfor
+basic
+bon
+bcpl
+altran
+formac
+#user
+#cmp list Ref
+#log
+#next
+62.2b 5
diff --git a/usr.bin/learn/lib/editor/L62.2b b/usr.bin/learn/lib/editor/L62.2b
new file mode 100644
index 00000000000..ebb674d1a79
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L62.2b
@@ -0,0 +1,32 @@
+#print
+ You can of course use any kind of addresses for the three addresses
+in the 'm' command. Think of the command as
+ "from address-1 until address-2 gather up and MOVE to address-3".
+OK. In the file "story" move the lines from the line
+that contains "back" until the line containing "prevail" to the
+end of the file. Then rewrite "story" and type "ready".
+#create Ref
+ Only twice in the nation's history has daylight-savings time been
+uniformly observed throughout the land -- during World War I, the first
+DST was tried, and again during World War II. Immediately after
+both wars, however, many areas abandoned DST altogether.
+ Last week the House voted 292 to 93 to require all states to move
+their clocks ahead an hour on the last Sunday in April, and set them
+back again on the last Sunday in October -- unless a state legislature
+specifically votes to stay on standard time. In that case, local
+options are out and standard time must prevail through the state.
+#create story
+ Only twice in the nation's history has daylight-savings time been
+uniformly observed throughout the land -- during World War I, the first
+DST was tried, and again during World War II. Immediately after
+both wars, however, many areas abandoned DST altogether.
+back again on the last Sunday in October -- unless a state legislature
+specifically votes to stay on standard time. In that case, local
+options are out and standard time must prevail through the state.
+ Last week the House voted 292 to 93 to require all states to move
+their clocks ahead an hour on the last Sunday in April, and set them
+#user
+#cmp story Ref
+#log
+#next
+62.2c 5
diff --git a/usr.bin/learn/lib/editor/L62.2c b/usr.bin/learn/lib/editor/L62.2c
new file mode 100644
index 00000000000..ecd799ffb7b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L62.2c
@@ -0,0 +1,49 @@
+#print
+In this directory is a file "word" which should be in alphabetical
+order but is not; put it in order by picking up a block of lines
+and relocating them. Then rewrite the file and type "ready".
+#create Ref
+bands
+becomes
+course
+dissolve
+events
+for
+have
+human
+in
+it
+necessary
+of
+one
+people
+political
+the
+to
+when
+which
+#create word
+bands
+becomes
+course
+in
+it
+necessary
+of
+one
+people
+political
+dissolve
+events
+for
+have
+human
+the
+to
+when
+which
+#user
+#cmp word Ref
+#log
+#next
+63.1a 10
diff --git a/usr.bin/learn/lib/editor/L63.1a b/usr.bin/learn/lib/editor/L63.1a
new file mode 100644
index 00000000000..a1f0acccd64
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L63.1a
@@ -0,0 +1,43 @@
+#print
+Line 0 is a legitimate address for a few commands;
+you can append text at the beginning of a file
+by typing
+ 0a
+and you can move lines to the beginning of a files
+by using
+ m0
+Move the last three lines of file "tax" to the beginning,
+then type "ready".
+#create Ref
+If you sustain an "overall foreign loss"
+for any taxable year,
+a recapture provision
+will treat a part of
+foreign income realized
+in a later year
+as income from
+U. S. sources.
+
+These rules generally apply
+to losses sustained in taxable
+years beginning after
+December 31, 1975.
+#create tax
+will treat a part of
+foreign income realized
+in a later year
+as income from
+U. S. sources.
+
+These rules generally apply
+to losses sustained in taxable
+years beginning after
+December 31, 1975.
+If you sustain an "overall foreign loss"
+for any taxable year,
+a recapture provision
+#user
+#cmp Ref tax
+#log
+#next
+63.1b 10
diff --git a/usr.bin/learn/lib/editor/L63.1b b/usr.bin/learn/lib/editor/L63.1b
new file mode 100644
index 00000000000..9b92488612a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L63.1b
@@ -0,0 +1,13 @@
+#print
+What command will move the current line
+to the beginning of the file? Type
+"answer COMMAND", where COMMAND is the command.
+#copyin
+#user
+#uncopyin
+#match m0
+#match .m0
+"m0" is easier.
+#log
+#next
+63.1c 10
diff --git a/usr.bin/learn/lib/editor/L63.1c b/usr.bin/learn/lib/editor/L63.1c
new file mode 100644
index 00000000000..0ef79dc2d20
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L63.1c
@@ -0,0 +1,13 @@
+#print
+What command will move the current line
+to the end of the file? Type
+"answer COMMAND", where COMMAND is the command.
+#copyin
+#user
+#uncopyin
+#match m$
+#match .m$
+"m$" is easier.
+#log
+#next
+63.1d 10
diff --git a/usr.bin/learn/lib/editor/L63.1d b/usr.bin/learn/lib/editor/L63.1d
new file mode 100644
index 00000000000..999926f9be0
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L63.1d
@@ -0,0 +1,12 @@
+#print
+Will the command
+ m+
+interchange lines "." and ".+1"?
+Answer yes or no.
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+63.1e 10
diff --git a/usr.bin/learn/lib/editor/L63.1e b/usr.bin/learn/lib/editor/L63.1e
new file mode 100644
index 00000000000..623394728f2
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L63.1e
@@ -0,0 +1,13 @@
+#print
+Will the command
+ m-
+interchange lines "." and ".-1"?
+Answer yes or no.
+#copyin
+#user
+#uncopyin
+#match no
+You actually need "m--".
+#log
+#next
+64.1a 10
diff --git a/usr.bin/learn/lib/editor/L64.1a b/usr.bin/learn/lib/editor/L64.1a
new file mode 100644
index 00000000000..93cf0451325
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L64.1a
@@ -0,0 +1,34 @@
+#print
+Another command similar to 'm' is 't';
+the command
+ 5,8t15
+picks up lines 5 through 8 and makes a copy of them,
+which it places after line 15. It differs from
+'m' only in that the lines remain in their old place
+as well as appearing in their new place. (Just like "cp"
+and "mv" with files). In this directory is a file
+"double". Using the editor, find the line containing
+"-------" and make a copy of it at the
+end of the file.
+#create Ref
+------------
+This file should be
+bracketed by the
+dashes but as it
+is given to you
+there are only dashes
+at the top.
+------------
+#create double
+------------
+This file should be
+bracketed by the
+dashes but as it
+is given to you
+there are only dashes
+at the top.
+#user
+#cmp double Ref
+#log
+#next
+64.1b 10
diff --git a/usr.bin/learn/lib/editor/L64.1b b/usr.bin/learn/lib/editor/L64.1b
new file mode 100644
index 00000000000..3c66753a57b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L64.1b
@@ -0,0 +1,14 @@
+#print
+Another exercise in the effective use of the 't'
+command: What command should be typed to make
+a second copy of the current line?
+Type "answer XX", where XX is the command.
+#copyin
+#user
+#uncopyin
+#match t.
+#match .t.
+You could just say "t.".
+#log
+#next
+65.1a 10
diff --git a/usr.bin/learn/lib/editor/L65.1a b/usr.bin/learn/lib/editor/L65.1a
new file mode 100644
index 00000000000..f51beaf84ee
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L65.1a
@@ -0,0 +1,37 @@
+#print
+A strange, and not often important command, is the 'l'
+(list) command. When it is needed, though, it is vital.
+It is almost identical to 'p' (print) except that control
+characters (like tab or backspace) are printed in a way
+that lets you see what they are no matter what the terminal does.
+From time to time strange characters will
+sneak into your files; they won't show when you print
+them, and yet they will confuse you. For example,
+you might be unable to find a line by searching
+for it with
+ /abc/
+and yet it would print as "abc" if there were
+a funny character in the line between 'a' and 'b'.
+Funny characters are generated by hitting the control
+keys on the terminal; they print as '\' followed
+by a number.
+There is a file "weird" in this directory. Print
+it both with "1,$p" and "1,$l"
+and observe the difference. Then leave the editor.
+Which word on the last line has a funny character in it?
+Type "answer WORD" where WORD is that word (without the funny
+symbol).
+#create weird
+This line has tabs in it.
+So does this one.
+Here is a line with____ backspaces of a useful sort.
+These backspacesonlyconfuse matters.
+
+there's a strange character in this line even though it prints ok.
+#copyin
+#user
+#uncopyin
+#match this
+#log
+#next
+66.1a 10
diff --git a/usr.bin/learn/lib/editor/L66.1a b/usr.bin/learn/lib/editor/L66.1a
new file mode 100644
index 00000000000..8ae60e5803d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L66.1a
@@ -0,0 +1,102 @@
+#print
+The file "memo" contains several paragraphs,
+where a paragraph starts at any line that begins with
+a blank. It is desired to remove those blanks at the beginning
+of lines, and instead mark the paragraphs by inserting
+a line containing only
+
+.PP
+
+before each paragraph. Change the file in that
+way and then rewrite it; then type "ready".
+#create Ref
+The Ascent of the Riffelberg
+by Mark Twain
+
+.PP
+I sat silent some time, then turned to Harris and said:
+``My mind is made up.''
+Something in my tone struck him; and when he glanced
+at my eye and read what was written there, his face paled
+perceptibly. He hesitated a moment, then said:
+``Speak.''
+.PP
+I answered, with perfect calmness:
+``I WILL ASCEND THE RIFFELBERG.''
+.PP
+If I had shot my poor friend he could not have fallen from
+his chair more suddenly. If I had been his father he
+could not have pleaded harder to get me to give up my
+purpose. But I turned a deaf ear to all he said. When he
+perceived at last that nothing could alter my determination,
+he ceased to urge, and for a while the deep silence was broken only
+by his sobs. I sat in marble resolution, with my
+eyes fixed upon vacancy, for in spirit I was already
+wrestling with the perils of the mountains, and my friend sat
+gazing at me in adoring admiration through his tears. At
+last he threw himself upon me in a loving embrace and
+exclaimed in broken tones:
+``Your Harris will never desert you. We will die together!''
+.PP
+I cheered the noble fellow with praises, and soon his fears
+were forgotten and he was eager for the adventure. He
+wanted to summon the guides at once and leave at two in
+the morning, as he supposed the custom was; but I explained that nobody
+was looking at that hour; and that the start in the dark
+was not usually made from the village but
+from the first night's resting-place on the mountainside. I
+said we would leave the village at 3 or 4 p.m. on the morrow;
+meantime he could notify the guides, and also let the public
+know of the attempt which we proposed to make.
+.PP
+I went to bed, but not to sleep. No man can sleep when
+he is about to undertake one of these Alpine exploits. I
+tossed feverishly all night long, and was glad enough when
+I heard the clock strike half past eleven and knew it was
+time to get up for dinner.
+#create memo
+The Ascent of the Riffelberg
+by Mark Twain
+
+ I sat silent some time, then turned to Harris and said:
+``My mind is made up.''
+Something in my tone struck him; and when he glanced
+at my eye and read what was written there, his face paled
+perceptibly. He hesitated a moment, then said:
+``Speak.''
+ I answered, with perfect calmness:
+``I WILL ASCEND THE RIFFELBERG.''
+ If I had shot my poor friend he could not have fallen from
+his chair more suddenly. If I had been his father he
+could not have pleaded harder to get me to give up my
+purpose. But I turned a deaf ear to all he said. When he
+perceived at last that nothing could alter my determination,
+he ceased to urge, and for a while the deep silence was broken only
+by his sobs. I sat in marble resolution, with my
+eyes fixed upon vacancy, for in spirit I was already
+wrestling with the perils of the mountains, and my friend sat
+gazing at me in adoring admiration through his tears. At
+last he threw himself upon me in a loving embrace and
+exclaimed in broken tones:
+``Your Harris will never desert you. We will die together!''
+ I cheered the noble fellow with praises, and soon his fears
+were forgotten and he was eager for the adventure. He
+wanted to summon the guides at once and leave at two in
+the morning, as he supposed the custom was; but I explained that nobody
+was looking at that hour; and that the start in the dark
+was not usually made from the village but
+from the first night's resting-place on the mountainside. I
+said we would leave the village at 3 or 4 p.m. on the morrow;
+meantime he could notify the guides, and also let the public
+know of the attempt which we proposed to make.
+ I went to bed, but not to sleep. No man can sleep when
+he is about to undertake one of these Alpine exploits. I
+tossed feverishly all night long, and was glad enough when
+I heard the clock strike half past eleven and knew it was
+time to get up for dinner.
+#user
+#cmp memo Ref
+#log
+#next
+70.1a 10
+70.2a 5
diff --git a/usr.bin/learn/lib/editor/L7.1a b/usr.bin/learn/lib/editor/L7.1a
new file mode 100644
index 00000000000..379e1da89b5
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L7.1a
@@ -0,0 +1,37 @@
+#print
+Although specifying lines by line number is
+easy to understand, it is hard to do in a long
+file. You will therefore want to learn other
+ways of addressing lines. The 'current line'
+is addressed with the symbol
+ .
+so that it can be printed, for example with
+ .p
+just as you could print a line by "3p".
+Try that in this file; the current line is
+set to the last line of the current file.
+Try ".p"; then "w", "q", and "ready" as usual.
+Here's the full file -
+
+#create Ref
+john quincy adams
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#print file
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -2 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+7.1b 10
diff --git a/usr.bin/learn/lib/editor/L7.1b b/usr.bin/learn/lib/editor/L7.1b
new file mode 100644
index 00000000000..84e229e2e1d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L7.1b
@@ -0,0 +1,41 @@
+#print
+As I said, '.' is set to the last line touched
+by any command in the editor. So if you type
+ 3p
+. will be set to line 3; and then
+ .p
+will print the same line.
+Try that -
+with the usual trailer, the commands should be
+
+3p
+.p
+w
+q
+ready
+The file is the same as before.
+#create Ref
+3p
+.p
+w
+q
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#pipe
+#copyin
+ed file
+#user
+#uncopyin
+#unpipe
+tail -4 .copy >X1
+#cmp X1 Ref
+#log
+#next
+8.1a 10
+8.2a 6
+7.2c 2
diff --git a/usr.bin/learn/lib/editor/L7.2c b/usr.bin/learn/lib/editor/L7.2c
new file mode 100644
index 00000000000..81aeabcde0a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L7.2c
@@ -0,0 +1,29 @@
+#print
+Now, print the fourth line in this file twice,
+using the same pattern. The file is the same,
+and you should put the usual finish (w, q, ready)
+after printing the line.
+#create Ref
+4p
+.p
+w
+q
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#pipe
+#copyin
+ed file
+#user
+#uncopyin
+#unpipe
+tail -4 .copy >X1
+#cmp X1 Ref
+#log
+#next
+8.1a 10
+8.2a 5
diff --git a/usr.bin/learn/lib/editor/L70.1a b/usr.bin/learn/lib/editor/L70.1a
new file mode 100644
index 00000000000..01049894b87
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.1a
@@ -0,0 +1,49 @@
+#print
+Perhaps the most powerful command in the editor is the 'g'
+(global) command. This always precedes a second command
+on the same command line; it selects those file lines
+on which the second command is to be executed.
+For example
+ g/abc/s/def/ghi/p
+says: "Find all lines in the file which
+contain the string "abc"; change the first
+"def" on any such line into "ghi". The command
+after the 'g' may be any command, of course.
+Needless to say, the expressions after the 'g' may
+include all the special characters.
+Edit the file "towns" so that each line beginning
+with "-" has " (county seat)" added at its end.
+Rewrite the file and type "ready".
+#create Ref
+-newark (county seat)
+ east orange
+ south orange
+ maplewood
+-elizabeth (county seat)
+ linden
+ cranford
+ westfield
+-morristown (county seat)
+ madison
+ chatham
+ dover
+#create towns
+-newark
+ east orange
+ south orange
+ maplewood
+-elizabeth
+ linden
+ cranford
+ westfield
+-morristown
+ madison
+ chatham
+ dover
+#user
+#cmp towns Ref
+#log
+#next
+71.1a 10
+70.2e 9
+70.2d 6
diff --git a/usr.bin/learn/lib/editor/L70.2a b/usr.bin/learn/lib/editor/L70.2a
new file mode 100644
index 00000000000..afb862befe1
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2a
@@ -0,0 +1,30 @@
+#print
+Perhaps the most powerful editor command is the 'g'
+(global) command. This command selects sets of lines
+on which other commands are executed. For example,
+ g/abc/p
+prints all lines on which 'abc' appears. In this directory
+is a file "story". Print all lines on which the word
+"of" appears. Then leave the editor and type "ready".
+#create Ref
+ The people of the United States are in a sense becoming a nation
+of the United States in the future, it will be because that system
+did too good a job of filling many of the needs of the people.
+#create story
+ The people of the United States are in a sense becoming a nation
+on a tiger. They must learn to consume more and more or, they are
+warned, their magnificent economic machine may turn and devour them.
+They must be induced to step up their individual consumption higher
+and higher, whether they have any pressing need for the goods or
+not. Their ever-expanding economy demands it.
+ If modifications are forced upon the private-enterprise system
+of the United States in the future, it will be because that system
+did too good a job of filling many of the needs of the people.
+#copyout
+#user
+#uncopyout
+grep of .ocopy >x1
+#cmp x1 Ref
+#log
+#next
+70.2b 5
diff --git a/usr.bin/learn/lib/editor/L70.2b b/usr.bin/learn/lib/editor/L70.2b
new file mode 100644
index 00000000000..b302fcfef17
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2b
@@ -0,0 +1,84 @@
+#print
+You can use any command with 'g', not just 'p'. For example
+ g/xx/s/a/b/
+changes 'a' to 'b' on every line containing 'xx'. As an
+example of the global command used with 'd', try this:
+In file "cities" there is a list of cities with their states and
+zip codes. Delete all cities which are in New Jersey (i.e. all
+lines containing NJ). Then rewrite the file and type "ready".
+#create Ref
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#create cities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#user
+#cmp cities Ref
+#log
+#next
+70.2c 5
+70.2d 10
diff --git a/usr.bin/learn/lib/editor/L70.2c b/usr.bin/learn/lib/editor/L70.2c
new file mode 100644
index 00000000000..cf3ce547307
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2c
@@ -0,0 +1,84 @@
+#print
+In this directory is another copy of the
+"cities" file as you modified it,
+and the previous version named "ocities".
+Use "diff" to find out how many lines you deleted.
+Reply "answer N" where N is the number of
+lines you removed from "cities".
+#create cities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#create ocities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#copyin
+#user
+#uncopyin
+#match 6
+#log
+#next
+70.2d 10
diff --git a/usr.bin/learn/lib/editor/L70.2d b/usr.bin/learn/lib/editor/L70.2d
new file mode 100644
index 00000000000..beb4bd0d7fd
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2d
@@ -0,0 +1,92 @@
+#print
+There is another file of cities with ZIP codes and states
+in this directory, but it was typed in wrong. Some cities
+in New Jersey are labeled as being in New York. However the
+ZIP codes are right. Since the cities in New Jersey are
+exactly those with zip codes beginning 07, if you
+can execute the substitute command to change NY to NJ on all
+lines with " 07" in them, all will be well.
+Don't forget the blank before the 07 - some ZIP
+codes have "07" in the middle, remember.
+Change file "cities" and rewrite it. Then type "ready".
+#create Ref
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#create cities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NY 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NY 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NY 07101
+Paterson NY 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#user
+#cmp cities Ref
+#log
+#next
+70.2e 5
diff --git a/usr.bin/learn/lib/editor/L70.2e b/usr.bin/learn/lib/editor/L70.2e
new file mode 100644
index 00000000000..ffc1bcdcfb8
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2e
@@ -0,0 +1,95 @@
+#print
+There is a file "cities" in this directory in which each line
+contains a city, state and ZIP code. But it was typed
+in by a member of management and is really botched - every
+NJ city is labeled as being in NY. But the Zip codes are right -
+if you can change NY to NJ on each line containing a ZIP code
+beginning with either 07 or 08 all will be fixed up. Each line
+looks like
+ St. Louis MO 63166
+and (1) remember the [] operators? and (2) don't forget
+that digits appear in the middle of ZIP codes.
+You may want to check what you're doing by writing the current
+version on a different file name and using "diff" to check
+on the changes.
+#create Ref
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#create cities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NY 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NY 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NY 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NY 07101
+Paterson NY 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#user
+#cmp cities Ref
+#log
+#next
+70.2f 5
diff --git a/usr.bin/learn/lib/editor/L70.2f b/usr.bin/learn/lib/editor/L70.2f
new file mode 100644
index 00000000000..b5aa2ebdd7a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2f
@@ -0,0 +1,90 @@
+#print
+Remember the search for blank lines with nothing on them? /^$/.
+Pick up the file "table" and delete all blank lines; then rewrite
+it and type "ready".
+#create Ref
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#create table
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+
+
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#user
+#cmp table Ref
+#log
+#next
+70.2g 5
diff --git a/usr.bin/learn/lib/editor/L70.2g b/usr.bin/learn/lib/editor/L70.2g
new file mode 100644
index 00000000000..3f34982f1df
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L70.2g
@@ -0,0 +1,36 @@
+#print
+Here is a file "values". Whenever the word
+"liter" appears in it, add at the end of that
+line the characters
+ (1 liter = 1.06 quart)
+The parentheses should appear in the final
+file, and there should be one space before the
+left parenthesis. When done, rewrite
+the file and type "ready".
+#create Ref
+gasoline: .52/gallon
+milk: 35/qt
+rice: .30/lb
+acetic acid: 1.20/liter (1 liter = 1.06 quart)
+apples: .35/lb
+cider: .55/liter (1 liter = 1.06 quart)
+butter: .79/lb
+soda: .42/liter (1 liter = 1.06 quart)
+eggs: .89/doz
+cream: 1.25/liter (1 liter = 1.06 quart)
+#create values
+gasoline: .52/gallon
+milk: 35/qt
+rice: .30/lb
+acetic acid: 1.20/liter
+apples: .35/lb
+cider: .55/liter
+butter: .79/lb
+soda: .42/liter
+eggs: .89/doz
+cream: 1.25/liter
+#user
+#cmp values Ref
+#log
+#next
+71.1a 5
diff --git a/usr.bin/learn/lib/editor/L71.1a b/usr.bin/learn/lib/editor/L71.1a
new file mode 100644
index 00000000000..1f665f31a01
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L71.1a
@@ -0,0 +1,108 @@
+#print
+After the global command has selected the lines
+to which the second command is to be applied, it sets '.' (the
+current line) to each of these lines in turn as it executes
+the controlled command. Thus you can reference the line
+before or after the selected line. For example,
+ g/xx/.-1s/ab/cd/
+changes 'ab' to 'cd' on the line BEFORE each line with xx.
+And
+ g/xx/$t.+1
+inserts a copy of the last line in the file two lines
+after each line with 'xx' on it.
+In this directory, the file 'memo' has paragraphs indicated
+by lines beginning ".PP". Add two blanks to the beginning of
+the line after each ".PP", and then delete the ".PP" lines.
+This should take only two commands. Rewrite the file and then
+type "ready".
+#create Ref
+The Ascent of the Riffelberg
+by Mark Twain
+
+ I sat silent some time, then turned to Harris and said:
+``My mind is made up.''
+Something in my tone struck him; and when he glanced
+at my eye and read what was written there, his face paled
+perceptibly. He hesitated a moment, then said:
+``Speak.''
+ I answered, with perfect calmness:
+``I WILL ASCEND THE RIFFELBERG.''
+ If I had shot my poor friend he could not have fallen from
+his chair more suddenly. If I had been his father he
+could not have pleaded harder to get me to give up my
+purpose. But I turned a deaf ear to all he said. When he
+perceived at last that nothing could alter my determination,
+he ceased to urge, and for a while the deep silence was broken only
+by his sobs. I sat in marble resolution, with my
+eyes fixed upon vacancy, for in spirit I was already
+wrestling with the perils of the mountains, and my friend sat
+gazing at me in adoring admiration through his tears. At
+last he threw himself upon me in a loving embrace and
+exclaimed in broken tones:
+``Your Harris will never desert you. We will die together!''
+ I cheered the noble fellow with praises, and soon his fears
+were forgotten and he was eager for the adventure. He
+wanted to summon the guides at once and leave at two in
+the morning, as he supposed the custom was; but I explained that nobody
+was looking at that hour; and that the start in the dark
+was not usually made from the village but
+from the first night's resting-place on the mountainside. I
+said we would leave the village at 3 or 4 p.m. on the morrow;
+meantime he could notify the guides, and also let the public
+know of the attempt which we proposed to make.
+ I went to bed, but not to sleep. No man can sleep when
+he is about to undertake one of these Alpine exploits. I
+tossed feverishly all night long, and was glad enough when
+I heard the clock strike half past eleven and knew it was
+time to get up for dinner.
+#create memo
+The Ascent of the Riffelberg
+by Mark Twain
+
+.PP
+I sat silent some time, then turned to Harris and said:
+``My mind is made up.''
+Something in my tone struck him; and when he glanced
+at my eye and read what was written there, his face paled
+perceptibly. He hesitated a moment, then said:
+``Speak.''
+.PP
+I answered, with perfect calmness:
+``I WILL ASCEND THE RIFFELBERG.''
+.PP
+If I had shot my poor friend he could not have fallen from
+his chair more suddenly. If I had been his father he
+could not have pleaded harder to get me to give up my
+purpose. But I turned a deaf ear to all he said. When he
+perceived at last that nothing could alter my determination,
+he ceased to urge, and for a while the deep silence was broken only
+by his sobs. I sat in marble resolution, with my
+eyes fixed upon vacancy, for in spirit I was already
+wrestling with the perils of the mountains, and my friend sat
+gazing at me in adoring admiration through his tears. At
+last he threw himself upon me in a loving embrace and
+exclaimed in broken tones:
+``Your Harris will never desert you. We will die together!''
+.PP
+I cheered the noble fellow with praises, and soon his fears
+were forgotten and he was eager for the adventure. He
+wanted to summon the guides at once and leave at two in
+the morning, as he supposed the custom was; but I explained that nobody
+was looking at that hour; and that the start in the dark
+was not usually made from the village but
+from the first night's resting-place on the mountainside. I
+said we would leave the village at 3 or 4 p.m. on the morrow;
+meantime he could notify the guides, and also let the public
+know of the attempt which we proposed to make.
+.PP
+I went to bed, but not to sleep. No man can sleep when
+he is about to undertake one of these Alpine exploits. I
+tossed feverishly all night long, and was glad enough when
+I heard the clock strike half past eleven and knew it was
+time to get up for dinner.
+#user
+#cmp memo Ref
+#log
+#next
+72.1a 10
+72.2a 5
diff --git a/usr.bin/learn/lib/editor/L72.1a b/usr.bin/learn/lib/editor/L72.1a
new file mode 100644
index 00000000000..c1fb0392165
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L72.1a
@@ -0,0 +1,48 @@
+#print
+A command related to the global command is the 'v' command.
+It also selects lines on which a second command is executed; the
+difference between 'g' and 'v' is that the selected lines
+for the 'v' command are all those on which the expression
+is NOT found. Thus
+ v/abc/s/x/y/g
+changes 'x' to 'y' on all lines NOT containing an 'abc'.
+There is a file 'price' in this directory. Find all lines
+that do NOT begin with blank and prefix three asterisks
+to them. Then rewrite the file and type "ready".
+#create Ref
+***beef
+ shoulder 1.39/lb
+ flank 1.59/lb
+ sirloin 2.19/lb
+ round 1.89/lb
+***fish
+ sword 3.99/lb
+ cod 1.99/lb
+ blues 2.49/lb
+ stripers 3.49/lb
+ flounder 2.99/lb
+***pork
+ shoulder .89/lb
+ loin 1.59/lb
+ bacon 1.19/lb
+#create price
+beef
+ shoulder 1.39/lb
+ flank 1.59/lb
+ sirloin 2.19/lb
+ round 1.89/lb
+fish
+ sword 3.99/lb
+ cod 1.99/lb
+ blues 2.49/lb
+ stripers 3.49/lb
+ flounder 2.99/lb
+pork
+ shoulder .89/lb
+ loin 1.59/lb
+ bacon 1.19/lb
+#user
+#cmp price Ref
+#log
+#next
+73.1a 10
diff --git a/usr.bin/learn/lib/editor/L72.2a b/usr.bin/learn/lib/editor/L72.2a
new file mode 100644
index 00000000000..d286e316d7a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L72.2a
@@ -0,0 +1,33 @@
+#print
+A command related to the 'g' command is the 'v' command. The
+'v' command also selects lines on which another command is to
+be executed; the difference between 'g' and 'v' is that
+the 'v' command selects all lines on which the specified
+expression is NOT found. Thus
+ v/ly$/p
+prints all lines which do NOT end in "ly".
+Or
+ v/e/p
+prints all lines WITHOUT an 'e'in them.
+Are there any lines in file "story"
+without an 'i'? Find out using the editor; then
+leave the editor and type "yes" or "no".
+#create story
+ Credit "rationing," already being imposed by major banks in
+big cities, may soon spread to banks large and small in every corner
+of the United States. Result: Speculative loans may become hard
+to get anywhere.
+ Working in near-secrecy, a committee of the powerful American
+Bankers Association is drafting an unprecedented policy statement
+aimed at getting bankers across the country to be far choosier in
+making business loans. The ABA it is believed, is being driven to
+this move partly by a nagging fear that the Federal Government will
+impose lending guidelines if banks fail to tighten up voluntarily.
+ The ABA's task is delicate.
+#copyin
+#user
+#uncopyin
+#match yes
+#log
+#next
+72.2b 10
diff --git a/usr.bin/learn/lib/editor/L72.2b b/usr.bin/learn/lib/editor/L72.2b
new file mode 100644
index 00000000000..b6a9d192b5d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L72.2b
@@ -0,0 +1,54 @@
+#print
+Edit the file "cities" to remove all lines NOT
+containing "NJ". Then rewrite the file
+and type "ready".
+#create Ref
+Camden NJ 08101
+Elizabeth NJ 07207
+Jersey City NJ 07303
+Newark NJ 07101
+Paterson NJ 07510
+Trenton NJ 08608
+#create cities
+Albany NY 12201
+Atlanta GA 30301
+Baltimore MD 21233
+Boston MA 02109
+Bridgeport CN 06601
+Buffalo NY 14240
+Camden NJ 08101
+Chicago IL 60607
+Dallas TX 75221
+Denver CO 80201
+Detroit MI 48226
+Elizabeth NJ 07207
+Hartford CN 06101
+Houston TX 77052
+Indianapolis IN 46204
+Jersey City NJ 07303
+Los Angeles CA 90053
+Miami FL 33101
+Milwaukee WI 53201
+Minneapolis MN 55401
+New York NY 10001
+Newark NJ 07101
+Paterson NJ 07510
+Philadelphia PA 19104
+Phoenix AR 85026
+Pittsburgh PA 15230
+Providence RI 02904
+Rochester NY 14603
+San Diego CA 92101
+San Francisco CA 94101
+Seattle WA 98101
+St. Louis MO 63166
+Syracuse NY 13201
+Trenton NJ 08608
+Utica NY 13503
+Washington DC 20013
+Yonkers NY 10598
+#user
+#cmp cities Ref
+#log
+#next
+72.2c 10
diff --git a/usr.bin/learn/lib/editor/L72.2c b/usr.bin/learn/lib/editor/L72.2c
new file mode 100644
index 00000000000..4218185bc7d
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L72.2c
@@ -0,0 +1,42 @@
+#print
+There is a file "price" in this directory. Find all
+lines which don't begin with blank and put three asterisks
+at the beginning of each such line. Then rewrite
+the file and type "ready".
+#create Ref
+***beef
+ shoulder 1.39/lb
+ flank 1.59/lb
+ sirloin 2.19/lb
+ round 1.89/lb
+***fish
+ sword 3.99/lb
+ cod 1.99/lb
+ blues 2.49/lb
+ stripers 3.49/lb
+ flounder 2.99/lb
+***pork
+ shoulder .89/lb
+ loin 1.59/lb
+ bacon 1.19/lb
+#create price
+beef
+ shoulder 1.39/lb
+ flank 1.59/lb
+ sirloin 2.19/lb
+ round 1.89/lb
+fish
+ sword 3.99/lb
+ cod 1.99/lb
+ blues 2.49/lb
+ stripers 3.49/lb
+ flounder 2.99/lb
+pork
+ shoulder .89/lb
+ loin 1.59/lb
+ bacon 1.19/lb
+#user
+#cmp price Ref
+#log
+#next
+72.2d 10
diff --git a/usr.bin/learn/lib/editor/L72.2d b/usr.bin/learn/lib/editor/L72.2d
new file mode 100644
index 00000000000..6f6fd89be10
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L72.2d
@@ -0,0 +1,27 @@
+#print
+There is a file "song" in this directory. Find all lines
+which don't end in "." and put a comma at the end of
+these lines. Then rewrite the file and type "ready".
+#create Ref
+It seems that Early English art,
+ Alone retains its zest.
+To charm and please its devotees,
+ We've done our level best.
+We're not quite sure that all we do,
+ Has the Early English ring,
+But as far as we can tell,
+ It's something lIke this sort of thing.
+#create song
+It seems that Early English art
+ Alone retains its zest.
+To charm and please its devotees
+ We've done our level best.
+We're not quite sure that all we do
+ Has the Early English ring
+But as far as we can tell
+ It's something lIke this sort of thing.
+#user
+#cmp song Ref
+#log
+#next
+73.1a 10
diff --git a/usr.bin/learn/lib/editor/L73.1a b/usr.bin/learn/lib/editor/L73.1a
new file mode 100644
index 00000000000..158d0d987b3
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L73.1a
@@ -0,0 +1,34 @@
+#print
+Back early in this sequence we made clear that
+the shell (the normal command interpreter) and the
+editor were distinct and they didn't pay any attention
+to each other's commands.
+Sometimes you are in the editor and you really want
+to execute a shell command. You can do that
+by prefixing it with !. For example,
+ !ls
+will list your directory.
+Remember that "date" is the shell command
+to find out what time it is.
+Try editing the file 'bridge'; print it out,
+then, without leaving the editor, ask for the
+time and then leave the editor and say "ready".
+#create bridge
+brooklyn
+manhattan
+williamsburg
+queensborough
+george washington
+triborough
+bronx whitestone
+throgs neck
+#create X2
+!date
+#copyin
+#user
+#uncopyin
+grep date .copy | tail -1 >X1
+#cmp X1 X2
+#log
+#next
+74.1a 10
diff --git a/usr.bin/learn/lib/editor/L74.1a b/usr.bin/learn/lib/editor/L74.1a
new file mode 100644
index 00000000000..08be154718b
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L74.1a
@@ -0,0 +1,80 @@
+#print
+Here's a last review exercise. In the file "cities" is a list
+of cities with populations and Zip codes. The following cities
+were omitted: add them in alphabetical order
+ St. Louis 622,236 MO 63166
+ Columbus 539,677 OH 43216
+Then, edit the file so that
+ (a) the blanks, if any, at the beginnings of lines and
+ends of lines are removed.
+ (b) each interior string of blanks is replaced by a single tab,
+except for the blanks within "Los Angeles", "New Orleans",
+"New York", "San Antonio", "San Diego", "San Francisco",
+and "St. Louis".
+ (c) Spell "Washington" and "Indianapolis" correctly.
+Then rewrite the file and type "ready".
+#create Ref
+Atlanta 496,973 GA 30301
+Baltimore 905,759 MD 21233
+Boston 641,071 MA 02109
+Bridgeport 156,542 CN 06601
+Buffalo 462,768 NY 14240
+Chicago 3,366,957 IL 60607
+Cleveland 750,903 OH 44101
+Columbus 539,677 OH 43216
+Dallas 844,401 TX 75221
+Denver 514,678 CO 80201
+Detroit 1,511,482 MI 48226
+Hartford 158,017 CN 06101
+Houston 1,232,802 TX 77052
+Indianapolis 774,624 IN 46201
+Los Angeles 2,809,596 CA 92101
+Miami 334,859 FL 33101
+Milwaukee 717,099 WI 53201
+Minneapolis 434,400 MN 55401
+New Orleans 593,471 LA 70140
+New York 7,894,862 NY 10001
+Newark 382,417 NJ 07901
+Omaha 347,328 NE 68108
+Philadephia 1,948,609 PA 19104
+Phoenix 581,562 AR 85026
+Pittsburgh 520,117 PA 15230
+San Antonio 654,153 TX 78205
+San Diego 696,769 CA 92101
+San Francisco 715,674 CA 94101
+Seattle 530,831 WA 98101
+St. Louis 622,236 MO 63166
+Washington 756,510 DC 20013
+#create cities
+ Atlanta 496,973 GA 30301
+ Baltimore 905,759 MD 21233
+Boston 641,071 MA 02109
+Bridgeport 156,542 CN 06601
+ Buffalo 462,768 NY 14240
+ Chicago 3,366,957 IL 60607
+Cleveland 750,903 OH 44101
+Dallas 844,401 TX 75221
+Denver 514,678 CO 80201
+Detroit 1,511,482 MI 48226
+Hartford 158,017 CN 06101
+Houston 1,232,802 TX 77052
+Indianpolis 774,624 IN 46201
+Los Angeles 2,809,596 CA 92101
+Miami 334,859 FL 33101
+ Milwaukee 717,099 WI 53201
+Minneapolis 434,400 MN 55401
+New Orleans 593,471 LA 70140
+New York 7,894,862 NY 10001
+Newark 382,417 NJ 07901
+ Omaha 347,328 NE 68108
+ Philadephia 1,948,609 PA 19104
+Phoenix 581,562 AR 85026
+Pittsburgh 520,117 PA 15230
+ San Antonio 654,153 TX 78205
+ San Diego 696,769 CA 92101
+ San Francisco 715,674 CA 94101
+ Seattle 530,831 WA 98101
+Washinggton 756,510 DC 20013
+#user
+#cmp cities Ref
+#log
diff --git a/usr.bin/learn/lib/editor/L8.1a b/usr.bin/learn/lib/editor/L8.1a
new file mode 100644
index 00000000000..ee421a44774
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L8.1a
@@ -0,0 +1,38 @@
+#print
+To move around, you can use simple arithmetic
+when specifying what to print. For example,
+ 3+1p
+is the same as
+ 4p
+as an editor command. Now that's not very interesting;
+but if the '.' current line pointer is line 3,
+then using
+ .+1p
+instead of 4p is helpful.
+For example, print the 3rd and 4th
+lines of the familiar file using first "3p" to
+get to line 3 and then ".+1p" to print the next line.
+End as usual with w, q, and ready.
+#create Ref
+thomas jefferson
+james madison
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -3 .ocopy >X1
+#cmp Ref X1
+#log
+#next
+9.1a 10
+8.1b 7
diff --git a/usr.bin/learn/lib/editor/L8.1b b/usr.bin/learn/lib/editor/L8.1b
new file mode 100644
index 00000000000..852bc4f95b9
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L8.1b
@@ -0,0 +1,18 @@
+#print
+You can also use "-" in addresses. For example,
+the line before the current line is line ".-1"
+and can be printed with ".-1p" or even just ".-1".
+How would you print the line two lines before the current
+line? Type "answer COMMAND" where COMMAND is
+the command you would type to print that line.
+#copyin
+#user
+#uncopyin
+#match .-2p
+#match .-2
+#match -2
+#match --
+#log
+#next
+9.1a 10
+9.2a 5
diff --git a/usr.bin/learn/lib/editor/L8.2a b/usr.bin/learn/lib/editor/L8.2a
new file mode 100644
index 00000000000..631b6f66d57
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L8.2a
@@ -0,0 +1,44 @@
+#print
+You can give addresses involving simple arithmetic
+to move around in the file. For example,
+ 3+1p
+is the same as
+ 4p
+in the editor. Now that's not interesting, but
+if the current line (".") is line 3, then
+ .+1p
+is also 4p; it prints the next line. For example,
+you can print the 3rd and 4th lines of this file
+using
+ 3p
+ .+1p
+ w
+ q
+where "3p" prints the third line, as usual,
+and then ".+1p" prints the next or fourth line.
+Try that. Type "ready" when done.
+#create Ref
+caslon
+century schoolbook
+86
+#create file
+baskerville
+bodoni
+caslon
+century schoolbook
+futura
+helvetica
+news gothic
+times roman
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -3 .ocopy >X1
+#cmp Ref X1
+#log
+#next
+8.2b 5
+9.1a 10
diff --git a/usr.bin/learn/lib/editor/L8.2b b/usr.bin/learn/lib/editor/L8.2b
new file mode 100644
index 00000000000..f7aeef5a7ee
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L8.2b
@@ -0,0 +1,26 @@
+#print
+Using the same scheme, print lines 2 and 3 of this file.
+Then rewrite it and leave and type "ready".
+#create Ref
+john adams
+thomas jefferson
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -3 .ocopy >X1
+#cmp Ref X1
+#log
+#next
+8.2c 3
+8.1b 8
diff --git a/usr.bin/learn/lib/editor/L8.2c b/usr.bin/learn/lib/editor/L8.2c
new file mode 100644
index 00000000000..bd33aac34d7
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L8.2c
@@ -0,0 +1,36 @@
+#print
+You can also use "-" in addresses.
+For example, you can print the
+line before the current line with
+ .-1p
+as a command. Again, I'll put
+you in the editor; print the fifth
+line and then the fourth, using this
+command to print lines in reverse
+order. Then leave with w, q, and ready.
+#create Ref
+carrots
+squash
+83
+#create file
+broccoli
+mushrooms
+cauliflower
+squash
+carrots
+lettuce
+string beans
+peas
+lima beans
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -3 .ocopy >X1
+#cmp Ref X1
+#log
+#next
+9.1a 10
+9.2a 5
diff --git a/usr.bin/learn/lib/editor/L9.1a b/usr.bin/learn/lib/editor/L9.1a
new file mode 100644
index 00000000000..7d5a1e7d061
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.1a
@@ -0,0 +1,34 @@
+#print
+Printing only one line at a time gets pretty
+slow. You can print several lines with
+commands like
+ 1,3p
+which prints lines 1, 2 and 3.
+Again, I'll put you into the editor
+with the familiar file. Print lines
+2 through 5 of it; then type w, q and ready.
+#create Ref
+john adams
+thomas jefferson
+james madison
+james monroe
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -5 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+10.1a 10
+9.2e 5
diff --git a/usr.bin/learn/lib/editor/L9.2a b/usr.bin/learn/lib/editor/L9.2a
new file mode 100644
index 00000000000..2ccb8daa373
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.2a
@@ -0,0 +1,36 @@
+#print
+You can print several lines at once by
+using commands like
+ 1,3p
+which prints lines 1, 2 and 3. Again,
+I'll put you into the editor. Print
+lines 1 to 3 of the file; then type
+w, q and ready.
+Your commands should look like
+ 1,3p
+ w
+ q
+ ready
+#create Ref
+george washington
+john adams
+thomas jefferson
+91
+#create file
+george washington
+john adams
+thomas jefferson
+james madison
+james monroe
+john quincy adams
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -4 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+9.2b 5
diff --git a/usr.bin/learn/lib/editor/L9.2b b/usr.bin/learn/lib/editor/L9.2b
new file mode 100644
index 00000000000..3f9aca81d5a
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.2b
@@ -0,0 +1,34 @@
+#print
+You can of course use any kind of line
+numbers for the addresses in the
+"p" command. Just as you did before,
+print lines 2 through 5 of this file,
+and then type w, q, and ready.
+#create Ref
+mushrooms
+cauliflower
+squash
+carrots
+83
+#create file
+broccoli
+mushrooms
+cauliflower
+squash
+carrots
+lettuce
+string beans
+peas
+lima beans
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+tail -5 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+9.3c 3
+9.2d 7
diff --git a/usr.bin/learn/lib/editor/L9.2d b/usr.bin/learn/lib/editor/L9.2d
new file mode 100644
index 00000000000..ed4e4081322
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.2d
@@ -0,0 +1,36 @@
+#print
+The "." operator can be used with multiple
+addresses to refer to the current line
+in either the first or second position (or both).
+For example, you could print from the current line
+to the 6th line with
+ .,6p
+and similarly for any other line. I'll put
+you in the editor again, with the current line
+set in the middle of a short file; print from
+the current line position to the fifth line, and
+then type w, q and ready.
+#create Ref
+ 2. UNIX
+ 3. hardware
+ 4. software
+ 5. manuals
+97
+#create file
+ 2. UNIX
+ 3. hardware
+ 4. software
+ 5. manuals
+you shouldn't have printed this line.
+#copyout
+#pipe
+ed file
+1t1
+#user
+#unpipe
+#uncopyout
+tail -5 .ocopy >X1
+#cmp X1 Ref
+#log
+#next
+9.2e 5
diff --git a/usr.bin/learn/lib/editor/L9.2e b/usr.bin/learn/lib/editor/L9.2e
new file mode 100644
index 00000000000..15ac77a3452
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.2e
@@ -0,0 +1,21 @@
+#print
+You can also employ addresses using arithmetic with
+this kind of command. For example, what "p" command
+would you type to print from line 2 to the line
+before the current line of the file? Remember what
+the line before the current line is:
+ .-1
+right?
+Type "answer COMMAND" where COMMAND is the specified
+"p" command.
+#copyin
+#user
+#uncopyin
+#match 2,.-1p
+#match 2,-p
+#match 2,.-p
+#log
+#next
+10.1a 10
+10.2a 5
+10.3a 2
diff --git a/usr.bin/learn/lib/editor/L9.3c b/usr.bin/learn/lib/editor/L9.3c
new file mode 100644
index 00000000000..859ccb0ecf6
--- /dev/null
+++ b/usr.bin/learn/lib/editor/L9.3c
@@ -0,0 +1,44 @@
+#print
+You can make up addresses for the 'p' command
+using '.' for the current line when there are
+two addresses, also. For example, you could
+print from the first line up to the present
+line with
+ 1,.p
+and I suggest you try that now. After
+that command, type the usual
+ w
+ q
+ ready
+#create Ref
+83
+broccoli
+mushrooms
+cauliflower
+squash
+carrots
+lettuce
+string beans
+peas
+lima beans
+83
+#create file
+broccoli
+mushrooms
+cauliflower
+squash
+carrots
+lettuce
+string beans
+peas
+lima beans
+#copyout
+#pipe
+ed file
+#user
+#unpipe
+#uncopyout
+#cmp .ocopy Ref
+#log
+#next
+9.2d 5