zsh-users
 help / color / mirror / code / Atom feed
* selecting a subset of an array
@ 2005-06-02  7:28 Wataru Kagawa
  2005-06-02  8:27 ` djh
  0 siblings, 1 reply; 4+ messages in thread
From: Wataru Kagawa @ 2005-06-02  7:28 UTC (permalink / raw)
  To: zsh-users

Sorry for another basic question, but how do I exclude a particular  
element from an array by using its name in a parameter expansion?   
For example, I would like to select everything except for  
'foo1:output file' from the following array, using only 'foo1' in the  
expansion.

_list=( 'foo1:output file' 'foo2:input file' 'foo3:output figs'  
'foo4:input figs' )

Help is much appreciated.


Wataru Kagawa


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: selecting a subset of an array
  2005-06-02  7:28 selecting a subset of an array Wataru Kagawa
@ 2005-06-02  8:27 ` djh
  2005-06-02  8:42   ` djh
  0 siblings, 1 reply; 4+ messages in thread
From: djh @ 2005-06-02  8:27 UTC (permalink / raw)
  To: zsh-users

Kagawa-san,
    try using ${array-namae:#pattern}    Here's the explanation I found 
in the manual.

--> If the parameter  is an ARRAY the matching array elements are removed.
      For the opposite effect use the `(M)' flag to remove the 
non-matched elements).

Darel Henman

--------------------

Wataru Kagawa wrote:

> Sorry for another basic question, but how do I exclude a particular  
> element from an array by using its name in a parameter expansion?   
> For example, I would like to select everything except for  
> 'foo1:output file' from the following array, using only 'foo1' in the  
> expansion.
>
> _list=( 'foo1:output file' 'foo2:input file' 'foo3:output figs'  
> 'foo4:input figs' )
>
> Help is much appreciated.
>
> Wataru Kagawa



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: selecting a subset of an array
  2005-06-02  8:27 ` djh
@ 2005-06-02  8:42   ` djh
  0 siblings, 0 replies; 4+ messages in thread
From: djh @ 2005-06-02  8:42 UTC (permalink / raw)
  To: zsh-users


Sorry, in my explanation I used a hypen in the parmater name inthe 
example and later realized that  you can not use a hyphen in a parmater 
name like I did.

So for your example:   ${_list:#foo1*}

> Kagawa-san,
>    try using ${array-namae:#pattern}    Here's the explanation I found 
> in the manual.
>
>>
>> _list=( 'foo1:output file' 'foo2:input file' 'foo3:output figs'  
>> 'foo4:input figs' )
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: selecting a subset of an array
@ 2005-06-02 10:55 Wataru Kagawa
  0 siblings, 0 replies; 4+ messages in thread
From: Wataru Kagawa @ 2005-06-02 10:55 UTC (permalink / raw)
  To: zsh-users

Hi Darel,

Thanks!  I was almost there.  I missed the colon mark.

Wataru Kagawa


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-02 10:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-02  7:28 selecting a subset of an array Wataru Kagawa
2005-06-02  8:27 ` djh
2005-06-02  8:42   ` djh
2005-06-02 10:55 Wataru Kagawa

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).