Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Glob specifiers for intermediate path components
- X-seq: zsh-users 19456
- From: Jörg Ziefle <joerg.ziefle@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Glob specifiers for intermediate path components
- Date: Thu, 27 Nov 2014 05:27:55 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=4L2jJT6AHmfKR4nLwWmQUfwm2NbyeNXtZdrkO9rofRU=; b=bnC7qoe0zj4YLDdTJ4eXmGbgOyz9w/hllEa3VkO0mm88NiZKg2fnJTNzAbIfgLiO6K bTMhb3Dhe3h2gFDYH3hxPY8lMXh+1K+1gMk9CKg0Ygxine0y7DTaEbKkwcRxqUBDHha5 tR+8yA57t3v0GM7f+TMmFF6Z54sVWxpK62mVFrnBgylAzgs1CMNJ0enb66msQZsDr0yD 21QXDOgllK5QoD8nA/kOQm/cdWe3RZWNq4doMip01HTT0SkFD7sv2SOegJefbewuvSB5 yXvCBOzn/zOogZ5wCzPoynwZakGuzot9AtBbxGvszcjshFvHSEwypeO9Bfvq4hxRorW9 Pb6g==
- In-reply-to: <141126175240.ZM11126@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAO8h=njW+7we5z+_E8pCYKdCG3UGUqWEJAZpsaQTts25ENpOyw@mail.gmail.com> <CAHYJk3TOZpJKUDxczqkr2RYJbOkjjN4mqG=kcf9o=3j=843QEA@mail.gmail.com> <141126175240.ZM11126@torch.brasslantern.com>
On Thu, Nov 27, 2014 at 2:52 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> A third would be something like this:
>
> glueglob() {
> emulate -R zsh -o csh_null_glob
> local here there
> while (( ARGC ))
> do
> here=( $^here$~1 )
> here=( ${^here}${2:+/} )
> shift
> done
> print $here
> }
> print -l $( noglob glueglob a(...) b(...) c(...) d(...) e(...) f(...) )
Works like a charm, thank you!
> There's almost certainly a fancy expression that could be written to
> split a(...)/b(...)/c(...)/d(...)/e(...)/f(...) on the slashes without
> being confused by the (/) glob qualifier, but I'm not going to attempt
> to write it tonight.
In Perl, it could look like:
$ perl -e '$_="a(.)/b(@)/c(/N)/d(*)/e(@)/f/g/h/i(/)"; while
(m{((.*?)(\(.*?\))?)(/|$)}g) { print "CHF 0.96\n" }'
a(.)
b(@)
c(/N)
d(*)
e(@)
f
g
h
i(/)
Not sure whether this solution is waterproof though.
Joerg
Messages sorted by:
Reverse Date,
Date,
Thread,
Author