summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/editor/L35.2e
blob: cd3a6a0f77640927d1a0588fe0143b4b8fc4795b (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
#print
A very powerful construction is ".*",
which matches any character (remember '.')
repeated any number of times.    For example

s/a.*b/.../

replaces anything of the forms

axyzb,  aaaaaab,   a1234b,  abbbb

since it requires just an 'a' and a 'b'
at the ends of the string, with
anything at all in between.
Or, to throw away everything
on a line after the word "stop", you could try

s/stop.*/stop/

In this directory is a file "sentence".
Delete everything after
the word "last" on the second line of the file.
#create Ref
This file has a sentence in which
this is the last
#create sentence
This file has a sentence in which
this is the last word which should be left.
#user
#cmp sentence Ref
#next
36.1a 10
36.2a 5