From: Vasiliy Ivanov <beelzebubbie.logs@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: (s) splitting - is there any way to provide "dynamic" separator
Date: Fri, 10 Oct 2014 13:06:21 +0600 [thread overview]
Message-ID: <5437856D.3050700@gmail.com> (raw)
In-Reply-To: <141009184525.ZM29875@torch.brasslantern.com>
On 10.10.2014 07:45, Bart Schaefer wrote:
> On Oct 9, 9:00pm, Vasiliy Ivanov wrote:
> }
> } Sorry if I (maybe) missed something obvious, but I failed to find a
> } way to use separator from parameter
> } (e.g. a='1:2:3'; sep=':'; print -l ${(s.$sep.)a}).
>
> Something like this:
>
> print -l ${(ps.\0.)a//$sep/$'\0'}
>
> (Assuming there are no nul-bytes in the value of $a to begin with.)
>
Thanks, this seems more elegant than «eval» way, but I failed to understand this:
% a='11::22:33'; b=("${(@s.:.)a}"); print $#b
4 (as expected)
but (I expected same result)
% a='11::22:33'; sep=':'; b=("${(@ps.\0.)a//$sep/$'\0'}"); print $#b
1
while
% a='11::22:33'; sep=':'; b=(${(@ps.\0.)a//$sep/$'\0'}); print $#b
3
--
Regards,
Vasiliy Ivanov <beelzebubbie.logs@gmail.com>
next prev parent reply other threads:[~2014-10-10 7:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-09 15:00 (s) splitting – is there any way to provide «dynamic» separator Vasiliy Ivanov
2014-10-09 21:14 ` Peter Stephenson
2014-10-09 21:48 ` Mikael Magnusson
2014-10-10 18:26 ` Peter Stephenson
2014-10-13 10:30 ` Peter Stephenson
2014-10-10 1:45 ` (s) splitting - is there any way to provid e "dynamic" separator Bart Schaefer
2014-10-10 7:06 ` Vasiliy Ivanov [this message]
2014-10-11 0:38 ` (s) splitting - is there any way to provide " Han Pingtian
2014-10-11 3:31 ` Bart Schaefer
2014-10-11 11:52 ` Han Pingtian
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=5437856D.3050700@gmail.com \
--to=beelzebubbie.logs@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@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).