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.

Reply via email to