bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Is there a way to change a string inplace by index?


From: Peng Yu
Subject: Re: [bug-gawk] Is there a way to change a string inplace by index?
Date: Sat, 3 Sep 2016 21:50:05 -0500

That is not inplace replacement. This solution create a new copy of
the string and assigned it to s.

On Sat, Sep 3, 2016 at 9:48 PM, david kerns <address@hidden> wrote:
> awk 'BEGIN { s = "0123456789"; i = 7-1; s = substr(s,0,i) "x" substr(s,i+2);
> print s }'
>
>
> On Sat, Sep 3, 2016 at 7:34 PM, Peng Yu <address@hidden> wrote:
>>
>> Hi, I don't find a way to replace some characters of a string inplace
>> by index. For example, I want to replace the i-th character of s by x.
>> Is there a way to do so in awk?
>>
>> s[i] = x
>>
>> --
>> Regards,
>> Peng
>>
>



-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]