这个问题在这里已有答案:
我有这个输入
[{"email":"etu@etu"},{"email":"hg"},{"email":"ismail"}]
我想使用bash只提取电子邮件中的值。
只需使用jq:
jq
echo '[{"email":"etu@etu"},{"email":"hg"},{"email":"ismail"}]' | jq -r '.[].email'
输出:
etu@etu hg ismail
我建议您使用一些unix工具,并在bash过程中调用它。
看看这个:json command line processor
你可能想调查这个,你可能会很高兴。