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

Re: Set difference between sets of files



On 2009-05-05 at 19:36 +0300, Itai Fiat wrote:
> I know that this can be done by writing both sets to temporary files, sorting
> them, and using the standard Unix command "comm", but is there an elegant way
> to do this from within Zsh?

I do set operations using the functions I posted in:
  http://www.zsh.org/mla/workers/2008/msg01422.html
which is zsh-workers 25763.

With those, you need a recent zsh release, since it uses new syntax
added by Peter in September last year.  zsh 4.3.7 or newer will be fine.

Then I use newset to declare a "set", implemented in zsh as an
auto-unique array, and the other functions in there to perform set
arithmetic.  I routinely use these functions to manipulate sets of
a couple thousand items, adding and removing and intersecting, etc, to
carry out my work.  It works for me and I got busy shortly thereafter so
I haven't come up with anything nicer.

-Phil



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