Commit | Line | Data |
---|---|---|
fd15fd37 BJ |
1 | |
2 | A range of line numbers can be used with the substitute | |
3 | command as with the print command. For example, | |
4 | ||
5 | $-4,$s/cat/&s/p | |
6 | ||
7 | will change "cat" into "cats" on the last five lines of | |
8 | a file. In this directory there is a file "cliche" | |
9 | containing a number of instances of the word "dog"; change | |
10 | the instances of "dog" in the first five lines to "dogs". | |
11 | Then rewrite the file and type "ready". | |
12 | #create Ref | |
13 | dogs tired | |
14 | sick as a dogs | |
15 | dogs eared | |
16 | wouldn't send a dogs out on a night like this | |
17 | every dogs has his day | |
18 | dog gone | |
19 | #create cliche | |
20 | dog tired | |
21 | sick as a dog | |
22 | dog eared | |
23 | wouldn't send a dog out on a night like this | |
24 | every dog has his day | |
25 | dog gone | |
26 | #user | |
27 | #cmp cliche Ref | |
28 | #log | |
29 | #next | |
30 | 37.2b 5 |