1

What zsh parameter expansion can filter out array elements that match a pattern (like what grep -v does)?

XDR
  • 4,070
  • 3
  • 30
  • 54
  • For all that I know, you can only search an array for a pattern (and even then, the pattern is a glob and not a regexp), but you can not create a subarry by providing a filtering expression. – user1934428 Jun 22 '20 at 10:00
  • @user1934428 Thanks. What is the syntax for the zsh glob array search? – XDR Jun 22 '20 at 12:36
  • `${array[(I)$value]}` yields the index where $value matches the array element. – user1934428 Jun 23 '20 at 14:48
  • 2
    Does this answer your question? [Filtering zsh array by wildcard](https://stackoverflow.com/questions/41872135/filtering-zsh-array-by-wildcard) – hchbaw Jun 27 '20 at 01:44
  • @hchbaw Yes. Thanks. – XDR Aug 05 '20 at 05:04

0 Answers0