On Thu Mar 12 10:09:06 PDT 2015, [email protected] wrote:

> On Mar 12, 2015 12:52 PM, "erik quanstrom" <[email protected]> wrote:
> > so an interesting problem i run into from time to time is separately
> computing
> > the files added to and deleted from a directory in a shell script.  uniq
> doesn't
> > work for this.  certainly one can loop over two lists of files and do
> this easily,
> > but that seems dull and tedious.
> >
> > but as it turns out, one can compute the deleted and added files
> relatively
> > efficiently with diff in two steps.  obviously uniq -d gives us the
> union, so
> >
> >         fn ∩ {echo $$1 $$2 | sed 's/ /\n/g' | sort | uniq -d}
> 
> Isn't this called (set) intersection?
> 

; grep `{unicode ∩} /lib/unicode
002229  intersection

> > and uniq -u gives us not union
> >
> >         fn not∩ {echo $$1 $$2 | sed 's/ /\n/g' | sort | uniq -u}
> 
> this is (set) symmetric difference.

that sounds like a reasonable name, but not one i remembered.

- erik

Reply via email to