Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Set difference between sets of files
- X-seq: zsh-users 14094
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Itai Fiat <itai.fiat@xxxxxxxxx>
- Subject: Re: Set difference between sets of files
- Date: Tue, 5 May 2009 16:58:45 -0700
- Cc: zsh-users@xxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200902; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=E8RHcgQi3mjGkrrTM5niRygT7HFCp+IKc5ouhN+3Y1/bXk8wiwpwwU64hU8jNkcobs7zzLIgD1olgSDT97dSav55AgQe3X/P0CG0/lMJ4n6QjbDNnjRFnK0wUkBIO7eE4nc7Jj1X/ktB5jJFd6xw1kphD04CFxgBdb3dGMkzq/c=;
- In-reply-to: <94de1b620905050936g442490e4t3da42ac3946cb29@xxxxxxxxxxxxxx>
- Mail-followup-to: Itai Fiat <itai.fiat@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <94de1b620905050936g442490e4t3da42ac3946cb29@xxxxxxxxxxxxxx>
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