我有以下JSON数据:
"email": "email1@gmail.com",
"displayName": "name1",
"email": "email2@gmail.com",
"displayName": "name2",
"displayName": "name3",
"email": "email3@mydomain.com",
第5行有错误,通常第一个是电子邮件,第二个displayName是错误的,但是在第5和第6行中它们是相反的
预期输出:
"email": "email1@gmail.com",
"displayName": "name1",
"email": "email2@gmail.com",
"displayName": "name2",
"email": "email3@mydomain.com",
"displayName": "name3",
这是我用来提取数据的命令:
cat database.json| jq -c '.[] | select(.type == "request")' | jq . | grep --color=never "displayName\|email"