Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Glob and grep



On 16/12/2019 23:18, dana wrote:
On 16 Dec 2019, at 16:44, Nick Cross <zsh@xxxxxxxxx> wrote:
While I found information about ^(xxx) it wasn't clear how to have multiple
expressions to ignore.

In addition to Mikael's suggestion you can also use the x~y syntax, which i
personally find less confusing, and is effectively `m/x/ && !m/y/` in Perl:

   **/*.groovy~*/(test|target)/*
   # or you can chain multiple y patterns
   **/*.groovy~*/test/*~*/target/*

(Note that, like zshexpn(1) says, / and . are not special in the y pattern)

On 16 Dec 2019, at 16:44, Nick Cross <zsh@xxxxxxxxx> wrote:
Am I right in thinking I can add (.) to e.g. *.groovy to ensure I only
search for files as well ?

Use (-.) if you also want to match symlinks to files (which is common)

dana



Firstly, thanks everyone for the replies. The '~' syntax is interesting; so effectively the negated options are put at the end.

Nick



Messages sorted by: Reverse Date, Date, Thread, Author