summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/editor/L6.1a
blob: 0e697aa59f1322bbbf2ce9b78d1fb22bdf019cc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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