From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <526FE8DB.5040709@gmx.de> Date: Tue, 29 Oct 2013 17:56:59 +0100 From: Friedrich Psiorz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [9fans] acme/sam language question Topicbox-Message-UUID: 889cbe4a-ead8-11e9-9d60-3106f5b1d025 this should do the trick /A/+#0;/B/-#0 g/CC/ s/CC/DD/g p ~Fritz Am 29.10.2013 16:31, schrieb Rudolf Sykora: > Hello, > > how can I set a dot from after A to before B, then make a global > substitution, within thus set dot, of CC to DD and print the resulting > text? > > I.e., if there isn't any CC between A and B, just print what's between > A and B, if there is, change it to DD and print all between A and B. > > I have sth like this > > /A/+#0;/B/-#0 s/CC/DD/g > p > > which works if there *is* the CC, but not if it is not there; then the > s command just resets the dot to an empty set. > > Thank you > Ruda >