Given the input json
[
{"title": "first line"},
{"title": "second line"},
{"title": "third line"}
]
How can we extract only the titles that contain keywords that are listed in a second "filter" array. Using a shell variable here for instance:
filter='["second", "third"]'
The output in this case would be
[
{"title": "second line"},
{"title": "third line"}
]
Also, how to use the array filter to negate instead. Eg: return only the "first line" entry in the previous example.
There is a similar reply but using an old version of jq. I hope that there's a more intuitive/readable way to do this with the current version of jq.