[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 20:08:21 +0200 |
On May 30, 2014, at 6:51 PM, Greg Wooledge <address@hidden> wrote:
> On Fri, May 30, 2014 at 06:34:47PM +0200, Richard Taubo wrote:
>> 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}
>
> echo "xyzABC123ABCxyz"
>
> Now, what are you REALLY trying to do?
I have solution working like this (thanks to input from this list earlier):
while IFS= read -r -d "" path; do
echo -n "<li><ul>"
echo -n "${path//\//<li>}"
echo -n"</ul></li>"
echo -n "</ul>"
done < <(find my_directory -print0)
It works fine, but I am measuring if I can get a little speed boost by doing
something like this:
find my_directory -print0 | /usr/bin/xargs -0 -I {} /bin/echo
"<li><ul>"${IS_IT_POSSIBLE_TO_PICK_UP_ECHO_VALUE_HERE//\//<li>}"</ul></li>"
Thanks!
Best regards,
Richard Taubo