Consider this basic JSON file:
{"list": [ {"random": 123,"fruits": "pineapple" }, {"random": 42,"fruits": "peach" }, {"random": 87,"fruits": "banana orange" } ]}How do I get all objects in list that have a fruits attribute without the substrings "apple" and "nana" (for example)? The list of blacklisted substrings is variable, so hardcoding with and or or is not an option. I have tried this:
jq --argjson exl '["apple","nana"]'' .list[] | select(.fruits | any($exl[]; contains(.)) | not)'It yields nothing, but I am expecting the object with "fruits": "peach". I feel like there is something wrong with my usage of any, but I can't find good documentation on it.