In jq, I can select an item in a list fairly easily:
$ echo '["a","b","c","d","e"]' | jq '.[] | select(. == ("a","c"))'
Or if you prefer to get it as an array:
$ echo '["a","b","c","d","e"]' | jq 'map(select(. == ("a","c")))'
But how do I select all of the items that are not in the list? Certainly . != ("a","c")
does not work:
$ echo '["a","b","c","d","e"]' | jq 'map(select(. != ("a","c")))'["a","b","b","c","d","d","e","e"]
The above gives every item twice, except for "a"
and "c
"
Same for:
$ echo '["a","b","c","d","e"]' | jq '.[] | select(. != ("a","c"))'"a""b""b""c""d""d""e""e"
How do I filter out the matching items?