|
|
1.1 root 1: #print
2: A very powerful construction is ".*",
3: which matches any character (remember '.')
4: repeated any number of times. For example
5:
6: s/a.*b/.../
7:
8: replaces anything of the forms
9:
10: axyzb, aaaaaab, a1234b, abbbb
11:
12: since it requires just an 'a' and a 'b'
13: at the ends of the string, with
14: anything at all in between.
15: Or, to throw away everything
16: on a line after the word "stop", you could try
17:
18: s/stop.*/stop/
19:
20: In this directory is a file "sentence".
21: Delete everything after
22: the word "last" on the second line of the file.
23: #create Ref
24: This file has a sentence in which
25: this is the last
26: #create sentence
27: This file has a sentence in which
28: this is the last word which should be left.
29: #user
30: #cmp sentence Ref
31: #next
32: 36.1a 10
33: 36.2a 5
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.