Since an example is worth a thousand words, say I have the following JSON stream:
{"a": 0, "b": 1}
{"a": 2, "b": 2}
{"a": 7, "b": null}
{"a": 3, "b": 7}
How can I keep all the objects for which the .b
property is one of [1, 7]
(in reality the list is much longer so I don't want to do select(.b == 1 or .b == 7)
). I'm looking for something like this: select(.b in [1, 7])
, but I couldn't find what I'm looking for in the man page.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…