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 <rudolf.syk...@gmail.com> wrote:
> On 31 October 2013 20:24, Rudolf Sykora <rudolf.syk...@gmail.com> wrote:
>> On 31 October 2013 16:49, Friedrich Psiorz <f.psi...@gmx.de> 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 get what I want (and what
>> you say). The problem appears when I want to run it from
>> a script like this:
>>
>> sam -d <<EOF $1  >[2] /dev/null
>> /A/+#0;/B/-#0
>> g/CC/ s/CC/DD/g
>> p
>> EOF
>>
>> then you get, since the g is on a seperate line, an extra
>> output from the line before g. And if you try to join g with
>> the match like
>>
>> sam -d <<EOF $1  >[2] /dev/null
>> /A/+#0;/B/-#0 g/CC/ s/CC/DD/g
>> p
>> EOF
>>
>> then you get no output if CC is not between A and B
>> (although when it is there, you get what I want).
>> In neither case I am fully satisfied. :)
>>
>> Thanks
>> Ruda
>
> So far I still do not know how to do it properly...
> But it seems nobody here proposes anything...
>
> Thanks for any clue
> Ruda
>

Reply via email to