Daniel Leidert <[email protected]> (Fr 08 Jan 2021 15:34:29 CET):
> Hi,
> 
> ich habe ein Shell-Skript, das eine Liste definiert:
> 
> LIST="
> Eintrag1
> Eintrag2
> Eintrag3
> "
> 
> und ein Kommando, dass ebenfalls eine Liste ausgibt:
> 
> $(command)
> 
> Nun möchte ich alle Einträge, die in $LIST enthalten sind aus der Ausgabe des
> Kommandos entfernen. Quasi
> 
> $(command) | grep -xv -e Eintrag1 -e Eintrag2 -e Eintrag3

```shell
LIST="
10
8
9
"

# variante a
comm -13 <(<<<$LIST sort) <(seq 1 10|sort)

# variante b
seq 1 10 | grep -xv -f <(echo "$LIST")
```

-- 
Heiko

Attachment: signature.asc
Description: PGP signature

Antwort per Email an