On Sunday, July 7, 2002, at 10:03  PM, bob ackerman wrote:

>
> On Monday, July 8, 2002, at 12:55  AM, Todd Wade wrote:
>
>>
>> "David Carpenter" <[EMAIL PROTECTED]> wrote in message
>> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>
>>> I have a text file with occasional strings enclosed in braces:
>>> kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . .
>>>
>>> I would like to use tr/// to modify the characters within the braces,
>> while
>>> leaving the rest of the file unchanged.
>>
>> tr///; is the wrong tool. you want s///;
>>
>> $ perl -e '($_ = <STDIN>) =~ s/{old}/{new}/g;print();'
>> im {old}, your old, whos {old}?
>> im {new}, your old, whos {new}?
>>
>> Is that what you are looking for?
>>
>> Todd W.
>>
> but he does what do to a 'tr' within the braces
> so this is a start:
> s/{(old)}/{$1}/g;
>
> but then the right side has to do an eval(tr///) or somesuch - it's too 
> late for me to work it out before i turn into a mushmelon at midnaught.

xtra thoughts: has to be non-greedy?
so:
s|{(.*?)}|$1=~ tr///|xg;

is that getting closer? (after filling in the 'tr', of quartz)

pob


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to