remove common lines with comm - 05-24-23
With help of ChatGPT I discovered this unix gem today.
Given two files
main_deck.txt:
1 Abzan Charm
1 Arcane Bombardment
1 Arcane Sanctum
1 Arcane Signet
1 Archmage Emeritus
1 Bant Charm
1 Boros Charm
1 Bring to Light
1 Brokers Charm
1 Brokers Confluence
considering.txt:
1 Abzan Charm
1 Arcane Sanctum
1 Taigam, Ojutai Master
1 Archmage Emeritus
1 Boros Charm
1 Tamanoa
1 Time Wipe
1 Trap Essence
1 Brokers Confluence
running
$ comm -23 <(cat considering.txt | sort) <(cat main_deck.txt | sort)
1 Taigam, Ojutai Master
1 Tamanoa
1 Time Wipe
1 Trap Essence
Returns a list of cards that are unique to the considering.txt.
If your text files are sorted you can skip the <(cat ..)
magic.
And yes. I’m using the cli two help build Magic the Gathering Decks!
\- [
comm
]