add the old snippet md files
This commit is contained in:
parent
fc0dd204c7
commit
bcf8313a4b
110 changed files with 3048 additions and 0 deletions
55
old_snippets/remove-common-lines.en.md
Normal file
55
old_snippets/remove-common-lines.en.md
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: "remove common lines with comm"
|
||||
seo_description: "How to remove common lines from files using the comm command"
|
||||
date: 2023-05-24T12:52:11+02:00
|
||||
draft: false
|
||||
snippet_types:
|
||||
- comm
|
||||
---
|
||||
|
||||
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
|
||||
|
||||
```shell
|
||||
$ 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!
|
||||
Loading…
Add table
Add a link
Reference in a new issue