Bash set subtraction

后端 未结 4 379
长发绾君心
长发绾君心 2021-01-11 10:48

How to subtract a set from another in Bash?

This is similar to: Is there a "set" data structure in bash? but different as it asks how to perform the subtra

4条回答
  •  鱼传尺愫
    2021-01-11 11:38

    I wrote a program recently called Setdown that does Set operations (like set difference) from the cli.

    It can perform set operations by writing a definition similar to what you would write in a Makefile:

    someUnion: "file-1.txt" \/ "file-2.txt"
    someIntersection: "file-1.txt" /\ "file-2.txt"
    someDifference: someUnion - someIntersection
    

    Its pretty cool and you should check it out. I personally don't recommend the "set operations in unix shell" post. It won't work well when you really need to do many set operations or if you have any set operations that depend on each other.

    At any rate, I think that it's pretty cool and you should totally check it out.

提交回复
热议问题