2
如何使用jq根据内部数组中的值过滤对象数组?
鉴于此输入: [ { "Id": "cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b", "Names": [ "condescending_jones", "loving_hoover" ] }, { "Id": "186db739b7509eb0114a09e14bcd16bf637019860d23c4fc20e98cbe068b55aa", "Names": [ "foo_data" ] }, { "Id": "a4b7e6f5752d8dcb906a5901f7ab82e403b9dff4eaaeebea767a04bac4aada19", "Names": [ "jovial_wozniak" ] }, { "Id": "76b71c496556912012c20dc3cbd37a54a1f05bffad3d5e92466900a003fbb623", "Names": [ "bar_data" ] } ] 我正在尝试使用jq构造一个过滤器,该过滤器返回Ids的所有对象,这些s 的内部数组中不包含“数据” Names,并且输出以换行符分隔。对于以上数据,我想要的输出是 cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b a4b7e6f5752d8dcb906a5901f7ab82e403b9dff4eaaeebea767a04bac4aada19 我想我与此有点接近: (. - select(.Names[] contains("data"))) | .[] .Id 但select过滤器不正确,并且无法编译(获取error: …