Commit | Line | Data |
---|---|---|
3eb5d546 C |
1 | |
2 | You can give addresses involving simple arithmetic | |
3 | to move around in the file. For example, | |
4 | 3+1p | |
5 | is the same as | |
6 | 4p | |
7 | in the editor. Now that's not interesting, but | |
8 | if the current line (".") is line 3, then | |
9 | .+1p | |
10 | is also 4p; it prints the next line. For example, | |
11 | you can print the 3rd and 4th lines of this file | |
12 | using | |
13 | 3p | |
14 | .+1p | |
15 | w | |
16 | q | |
17 | where "3p" prints the third line, as usual, | |
18 | and then ".+1p" prints the next or fourth line. | |
19 | Try that. Type "ready" when done. | |
20 | #create Ref | |
21 | caslon | |
22 | century schoolbook | |
23 | 86 | |
24 | #create file | |
25 | baskerville | |
26 | bodoni | |
27 | caslon | |
28 | century schoolbook | |
29 | futura | |
30 | helvetica | |
31 | news gothic | |
32 | times roman | |
33 | #copyout | |
34 | #pipe | |
35 | ed file | |
36 | #user | |
37 | #unpipe | |
38 | #uncopyout | |
39 | tail -3 .ocopy >X1 | |
40 | #cmp Ref X1 | |
41 | #log | |
42 | #next | |
43 | 8.2b 5 | |
44 | 9.1a 10 |