Re: [9fans] acme/sam language question

2013-11-21 Thread Rudolf Sykora
On 6 November 2013 21:42, Mark van Atten wrote: > I write the script like this: > > /A/+#0;/B/-#0 { > g/CC/ s/CC/DD/g > } > p I finally get around to trying this out and (so far) it seems to work. Thank you! Ruda

Re: [9fans] acme/sam language question

2013-11-21 Thread Mark van Atten
> I finally get around to trying this out and (so far) it seems to work. > Thank you! You're welcome! Opening the group at the end of the first line has the effect of replacing the empty command and its implied p; see sam's man page under `Miscellany'. This also explains why your lines, without t

Re: [9fans] acme/sam language question

2013-11-06 Thread Mark van Atten
I write the script like this: /A/+#0;/B/-#0 { g/CC/ s/CC/DD/g } p Mark. On Wed, Nov 6, 2013 at 7:47 PM, Rudolf Sykora wrote: > On 31 October 2013 20:24, Rudolf Sykora wrote: >> On 31 October 2013 16:49, Friedrich Psiorz wrote: >>> It works for me, but I found another inconsistency. >>> >>> I

Re: [9fans] acme/sam language question

2013-11-06 Thread Micah Stetson
What if you specify the address twice like this: /A/+#0;/B/-#0g/CC/ s/CC/DD/g /A/+#0;/B/-#0p That doesn't work if A and B occur more than once in the file or if DD matches A or B. But otherwise, it seems to work for me. Micah On Nov 6, 2013, at 10:47 AM, Rudolf Sykora wrote: > On 31 October 2

Re: [9fans] acme/sam language question

2013-11-06 Thread Rudolf Sykora
On 31 October 2013 20:24, Rudolf Sykora wrote: > On 31 October 2013 16:49, Friedrich Psiorz wrote: >> It works for me, but I found another inconsistency. >> >> I tried it on p9p and 9vx, both in acme and sam. > > /A/+#0;/B/-#0 > g/CC/ s/CC/DD/g > p > > Well. If I use these commands on

Re: [9fans] acme/sam language question

2013-10-31 Thread Rudolf Sykora
On 31 October 2013 16:49, Friedrich Psiorz wrote: > It works for me, but I found another inconsistency. > > I tried it on p9p and 9vx, both in acme and sam. /A/+#0;/B/-#0 g/CC/ s/CC/DD/g p Well. If I use these commands one by one inside p9p acme (and probably sam, too), I truly ge

Re: [9fans] acme/sam language question

2013-10-31 Thread Friedrich Psiorz
It works for me, but I found another inconsistency. I tried it on p9p and 9vx, both in acme and sam. 9vx acme is different form the others, for some reason. It does print the string between A and B, but prints it with CC and not with DD like sam and like p9p acme. ~Fritz Am 31.10.2013 16:21, sch

Re: [9fans] acme/sam language question

2013-10-31 Thread Rudolf Sykora
On 30 October 2013 08:47, Rudolf Sykora wrote: > On 29 October 2013 17:56, Friedrich Psiorz wrote: >> this should do the trick >> >> /A/+#0;/B/-#0 >> g/CC/ s/CC/DD/g >> p > > Thanks for the suggestion, the g construct didn't come to my mind. > However, it doesn't work for me: again, if CC is ther

Re: [9fans] acme/sam language question

2013-10-30 Thread Rudolf Sykora
On 29 October 2013 17:56, Friedrich Psiorz wrote: > this should do the trick > > /A/+#0;/B/-#0 > g/CC/ s/CC/DD/g > p Thanks for the suggestion, the g construct didn't come to my mind. However, it doesn't work for me: again, if CC is there, it works; if it's not, then the final dot only contains t

Re: [9fans] acme/sam language question

2013-10-29 Thread Friedrich Psiorz
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 an

[9fans] acme/sam language question

2013-10-29 Thread 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