From: Stephane CHAZELAS <stephane_chazelas@yahoo.fr>
To: zsh-users@zsh.org
Subject: Re: Hexadecimalic question ;)
Date: Thu, 10 Nov 2011 19:44:19 +0000 (UTC) [thread overview]
Message-ID: <slrnjboacj.u6s.stephane.chazelas@spam.is.invalid> (raw)
In-Reply-To: <20111110174811.GF24333@solfire>
2011-11-10, 18:48(+01), meino.cramer@gmx.de:
> Hi,
>
> I have a string conatining hex digits like this:
>
> hexdig="b05a02d7d1df3e6993eca90fa00241550dc95ec8e22d9b7194e2549cbd2f0ee37ec802d358d7447e0d78568d6f927ca4695173979e0f46573073cc8a785ac181"
>
> and I have an Array like this
>
> arr=( T h i s i s a n e x a m p l e ! ) # Could be any othe contents!
>
> Now I want to step through hexdig digit by digit and use every single
> digit as an index into arr by interpreting each digit as hexadecimal
> digit.
>
> Unfortunately I haven't any succes in doing so...
[...]
echo ${hexdig//(#m)?/$arr[1+16#$MATCH]}
also works with:
arr="Thisisanexample!"
--
Stephane
prev parent reply other threads:[~2011-11-10 20:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 17:48 meino.cramer
2011-11-10 17:55 ` Mikael Magnusson
2011-11-10 19:44 ` Stephane CHAZELAS [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrnjboacj.u6s.stephane.chazelas@spam.is.invalid \
--to=stephane_chazelas@yahoo.fr \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).