blob: ffa16c53b03d3a83f527693643cf914959d9c243 (
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
|
#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
|