【发布时间】:2022-12-09 23:52:32
【问题描述】:
我有一个非常大的 json 文档(~100 GB),我正在尝试使用 jq 来解析满足给定条件的特定对象。因为它太大了,我无法将它读入内存,需要使用 --stream 选项。
我了解如何运行 select 以在我不进行流式传输时提取我需要的内容,但可以使用一些帮助来弄清楚如何正确配置我的命令。
这是我名为example.json 的文档示例。
{
"reporting_entity_name" : "INSURANCE COMPANY",
"reporting_entity_type" : "INSURER",
"last_updated_on" : "2022-12-01",
"version" : "1.0.0",
"in_network" : [ {
"negotiation_arrangement" : "ffs",
"name" : "ER VISIT",
"billing_code_type" : "CPT",
"billing_code_type_version" : "2022",
"billing_code" : "99285",
"description" : "HIGHEST LEVEL ER VISIT",
"negotiated_rates" : [ {
"provider_groups" : [ {
"npi" : [ 111111111, 222222222],
"tin" : {
"type" : "ein",
"value" : "99-9999999"
}
} ],
"negotiated_prices" : [ {
"negotiated_type" : "negotiated",
"negotiated_rate" : 550.50,
"expiration_date" : "9999-12-31",
"service_code" : [ "23" ],
"billing_class" : "institutional"
} ]
} ]
}
]
}
我正在尝试获取 in_network 对象,其中 billing_code 等于 99285。
如果我能够在没有流式传输的情况下做到这一点,我将采用以下方法:
jq '.in_network[] | select(.billing_code == "99285")' example.json
非常感谢任何有关如何使用 --stream 选项配置它的帮助!
【问题讨论】:
-
你想要整个
in_network对象吗?请张贴精确的预期的输出,而不是猜测