【发布时间】:2019-02-19 13:07:34
【问题描述】:
我有以下代码,我尝试使用jq 仅提取“数字”。我研究了各种jq 代码示例。
我尝试了不同的代码变体:
jq '.data | .numbers'
和
jq '.data | .numbers[1:3]'
但我无法仅获得数字。
{
page_size: 3,
data: {
numbers: {
+18459939294: {
state: in_service,
features: [e911, outbound_cnam, inbound_cnam],
features_allowed: [],
features_denied: [],
},
+12018986776: {
state: in_service,
features: [],
features_allowed: [],
features_denied: [],
},
+12120098763: {
state: in_service,
features: [],
features_allowed: [],
features_denied: [],
}
},
casquade_quantity: 3
},
revision: 79807405987349087540983759804,
timestamp: 2018 - 09 - 14T17: 07: 49,
version: x.x.x,
node: aojflksajflkmaMmiaonfsd,
request_id: -098230-49823049-82309,
status: success,
}
我怎样才能得到输出:
+18459939294
+12018986776
+12120098763
【问题讨论】:
-
这不是有效的 JSON:你的字符串没有被引用,而且你有多余的逗号
-
你是对的。对于那个很抱歉。感谢格伦的帮助。真的很感激。