我有一个 JSON 输入:
{
"policyItems": [
{
"accesses": [
{
"type": "submit-app",
"isAllowed": true
}
],
"users": [],
"groups": [
"Application_Team_1",
"team2"
],
"conditions": [],
"delegateAdmin": false
}
]
}
我做了一个命令行 curl 来显示队列策略纱线:
curl -u "login:password" http://myHost:6080/service/public/v2/api/service/YARN_Cluster/policy/YARN%20NameQueue/
它工作正常。
然后我添加grep
以提取所有组项目列表:
curl -u "login:password" http://myHost:6080/service/public/v2/api/service/YARN_Cluster/policy/YARN%20NameQueue/ |
grep -oP '(?<="groups": ")[^"]*'
结果如下:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 579 0 579 0 0 4384 0 --:--:-- --:--:-- --:--:-- 4419
它不工作。我怎样才能使用grep
而不是jq
呢?