BSD 3 development
[unix-history] / usr / lib / learn / editor / L70.1a
CommitLineData
fd15fd37
BJ
1#print
2Perhaps the most powerful command in the editor is the 'g'
3(global) command. This always precedes a second command
4on the same command line; it selects those file lines
5on which the second command is to be executed.
6For example
7 g/abc/s/def/ghi/p
8says: "Find all lines in the file which
9contain the string "abc"; change the first
10"def" on any such line into "ghi". The command
11after the 'g' may be any command, of course.
12Needless to say, the expressions after the 'g' may
13include all the special characters.
14Edit the file "towns" so that each line beginning
15with "-" has " (county seat)" added at its end.
16Rewrite the file and type "ready".
17#create Ref
18-newark (county seat)
19 east orange
20 south orange
21 maplewood
22-elizabeth (county seat)
23 linden
24 cranford
25 westfield
26-morristown (county seat)
27 madison
28 chatham
29 dover
30#create towns
31-newark
32 east orange
33 south orange
34 maplewood
35-elizabeth
36 linden
37 cranford
38 westfield
39-morristown
40 madison
41 chatham
42 dover
43#user
44#cmp towns Ref
45#log
46#next
4771.1a 10
4870.2e 9
4970.2d 6