[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Substring Replacement
From: |
Richard Taubo |
Subject: |
Re: [Help-bash] Substring Replacement |
Date: |
Fri, 30 May 2014 18:50:27 +0200 |
On May 30, 2014, at 6:39 PM, Dennis Williamson <address@hidden> wrote:
> Use sed.
So it is not possible to do this just using Bash string manipulation?
> Forced how, btw?
Speed. I could have solved it using a while loop, but it seems to add time for
big sets.
(more after the concept here, so just using dummy code).
Best regards,
Richard Taubo
> On Fri, May 30, 2014 at 11:34 AM, Richard Taubo <address@hidden> wrote:
>
>> Hi!
>>
>> On http://tldp.org/LDP/abs/html/string-manipulation.html I find the
>> following example:
>> stringZ=abcABC123ABCabc
>> echo ${stringZ//abc/xyz} # xyzABC123ABCxyz
>> # Replaces all
>> matches of 'abc' with # 'xyz'.
>>
>> If you are forced to run everything on one line without using variables,
>> how
>> could one accomplish this, e.g:
>> echo "abcABC123ABCabc" | echo ${????//abc/xyz}
>>
>>
>> Thanks for feedback!