Those mathematical notations, are you using them because it makes it easier to see how it corresponds to actual Set Theory/theorems? If so, could you just as well have used an alphanummeric identifier like "left" "union" "right" or - would the code break without this notation? I'm on deep waters here, I don't know this. But set theory seems to pop up a lot in my line of work, essentially doing joins in datasets using Tableau - so my interest in the nitty gritty of this field is increasing.
> because it makes it easier to see how it corresponds to actual Set Theory/theorems?
Yes. These are the Unicode symbols for set theory.
> could you just as well have used an alphanummeric identifier like "left" "union" "right" or
Yes. You can use any of the words in the case switch statements, such as `setop union file1 file2`. You can also edit the script to add your own words if you like.
You can see simpler versions of these scripts in our GitHub repos. For example the `union` command is https://github.com/sixarm/union
> set theory seems to pop up a lot in my line of work
More and more in mine too. Thank you for your comments!
We benefit from simple analytics that are POSIX, not python, perl, R, etc. http://www.numcommand.com/
Yes in my experience of awk/gawk on Windows, things work the same, other than file separators, line endings, and similar platform-specific issues.
For your second question, awk simply works. It's reliable, fast, and everywhere. I also like python and perl, and choose these for any modern system.
I mean without resorting to awk.
For comparison, a typical POSIX `uniq` implementation reads the input and solely compares two adjacent lines; this requires the input to be presorted.
An interesting upgrade could be to add a `setop` option flag that tells the script the inputs are already sorted and/or deduped. This can achieve the memory savings you're describing.
I prefer `awk` over `uniq` and `comm` because awk tends to be faster at set ops that can skip sorting and deduplicating.
Here's my script for union, intersection, etc. See README on GitHub. Suggestions welcome.
https://github.com/sixarm/setop