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
> 


Reply via email to