【发布时间】:2021-01-03 08:40:32
【问题描述】:
我是 gcp 和 linux 的新手。我正在尝试使用gcloud 命令从json 格式中获取名称。
下面是命令和输出:
gcloud firestore indexes composite list --format=json
输出:
[
{
"fields": [
{
"fieldPath": "is_active",
"order": "ASCENDING"
},
{
"fieldPath": "created_at",
"order": "DESCENDING"
},
{
"fieldPath": "__name__",
"order": "ASCENDING"
}
],
"name": "projects/emc-ema-simcs-d-286404/databases/(default)/collectionGroups/customer/indexes/CICAgNjbhowK",
"queryScope": "COLLECTION",
"state": "READY"
}
如何使用 gcloud 命令获取 name 值。
我尝试使用:gcloud firestore indexes composite list | grep name | awk -F'name: ' '{print $2}',但这没有给出任何输出。
请帮忙!
谢谢 英式
【问题讨论】:
标签: json bash shell awk terminal