From: Mikael Magnusson <mikachu@gmail.com>
To: meino.cramer@gmx.de
Cc: zsh-users@zsh.org
Subject: Re: Hexadecimalic question ;)
Date: Thu, 10 Nov 2011 18:55:50 +0100 [thread overview]
Message-ID: <CAHYJk3Qs0HToA=c+pbPxYNf2K9p74W+xadW5jhgmdJ-9sxQ-VQ@mail.gmail.com> (raw)
In-Reply-To: <20111110174811.GF24333@solfire>
On 10 November 2011 18:48, <meino.cramer@gmx.de> wrote:
> 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.
% for i in ${(s::)hexdig}; do echo -n $arr[$(( 16#$i + 1 ))]; done; echo
mTsaTilnlhl!seaxxsepaxT!aTTiihssTlpxsepeeiilxmnhxieisixpmli!TeesnepeTilsselniineTlnesaela!xinpaiaxshnsxnxeT!iasnsTnsppeanesapheh
--
Mikael Magnusson
next prev parent reply other threads:[~2011-11-10 17:56 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 [this message]
2011-11-10 19:44 ` Stephane CHAZELAS
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='CAHYJk3Qs0HToA=c+pbPxYNf2K9p74W+xadW5jhgmdJ-9sxQ-VQ@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=meino.cramer@gmx.de \
--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).