我正在尝试使用 jq 创建一个带有 json 标头的 csv 文件。
我有以下片段https://jqplay.org/s/H_U5mxbTFW
问题:
如何打印peerings > accept_vpc_info > tenant_id
和的值peerings > accept_vpc_info > vpc_id
我尝试过的:
JSON
{
"peerings": [
{
"accept_vpc_info": {
"tenant_id": "184a5",
"vpc_id": "0d11f"
},
"created_at": "2018-11-07T08:53:43",
"description": null,
"id": "0b19d",
"name": "NAME1",
"request_vpc_info": {
"tenant_id": "08a7b",
"vpc_id": "1645f"
},
"status": "ACTIVE",
"updated_at": "2018-11-07T09:47:44"
},
{
"accept_vpc_info": {
"tenant_id": "067eb",
"vpc_id": "17944"
},
"created_at": "2019-06-12T08:29:08",
"description": null,
"id": "0d34a",
"name": "NAME2",
"request_vpc_info": {
"tenant_id": "0fd7b",
"vpc_id": "102c9"
},
"status": "ACTIVE",
"updated_at": "2019-06-12T12:04:56"
},
{
"accept_vpc_info": {
"tenant_id": "0ae21",
"vpc_id": "071c4"
},
"created_at": "2019-02-21T09:07:35",
"description": null,
"id": "173e2",
"name": "NAME3",
"request_vpc_info": {
"tenant_id": "05a21",
"vpc_id": "0586e"
},
"status": "ACTIVE",
"updated_at": "2019-02-21T09:10:41"
}
]
}
金泉:
.[] | flatten | map({created_at,description,id,name,status,updated_at}) | (first | keys_unsorted) as $keys | map([to_entries[] | .value]) as $rows | $keys,$rows[] | join (", ")
它无需添加accept_vpc_info
和即可工作request_vpc_info
。
我尝试将 这些添加为标题:accept_vpc_info
,,,,,,,,,,,,,,,,accept_vpc_info_tenant_id
accept_vpc_info_vpc_id
created_at
description
id
name
request_vpc_info
request_vpc_info_tenant_id
request_vpc_info_vpc_id
status
updated_at
像这样的东西:
"accept_vpc_info__tenant_id","accept_vpc_info__vpc_id","created_at","description","id","name","request_vpc_info__tenant_id","request_vpc_info__vpc_id","status","updated_at"
"184a5","0d11f","2018-11-07T08:53:43","null","0b19d","NAME1","08a7b","1645f","ACTIVE","2018-11-07T09:47:44"
"067eb","17944","2019-06-12T08:29:08","null","0d34a","NAME2","0fd7b","102c9","ACTIVE","2019-06-12T12:04:56"
"0ae21","071c4","2019-02-21T09:07:35","null","173e2","NAME3","05a21","0586e","ACTIVE","2019-02-21T09:10:41"
peerings > accept_vpc_info > tenant_id
我怎样才能打印和的值peerings > accept_vpc_info > vpc_id
?
谢谢
答案1
使用 jq 您可以运行以下内容:
- (假设您只想选择一些字段)创建一个 jq 过滤器“x.jq”
["name","id","tenant","vpc"] , ### the csv header
(.peerings[] ### for all in peerings list
| [ .name,
.id,
.accept_vpc_info.tenant_id,
.accept_vpc_info.vpc_id
]
) | @csv
- 运行!
$ jq -rf x.jq ex.json
"name","id","tenant","vpc"
"NAME1","0b19d","184a5","0d11f"
"NAME2","0d34a","067eb","17944"
"NAME3","173e2","0ae21","071c4"
答案2
使用csvkit
,可以直接将 Json 翻译为 CVS
$ in2csv -k peerings ex.json
accept_vpc_info/tenant_id,accept_vpc_info/vpc_id,created_at,description,id,name,request_vpc_info/tenant_id,request_vpc_info/vpc_id,status,updated_at
184a5,0d11f,2018-11-07T08:53:43,,0b19d,NAME1,08a7b,1645f,ACTIVE,2018-11-07T09:47:44
067eb,17944,2019-06-12T08:29:08,,0d34a,NAME2,0fd7b,102c9,ACTIVE,2019-06-12T12:04:56
0ae21,071c4,2019-02-21T09:07:35,,173e2,NAME3,05a21,0586e,ACTIVE,2019-02-21T09:10:41
in2csv
有关更多选项和详细信息,请参阅手册。
答案3
我通常不喜欢同时使用两种工具应该完成这项工作,但您可能会考虑使用 Miller 的(有限的)JSON 到 CSV 转换功能 - 这似乎是一种限制实际上有所帮助的情况(因为它默认情况下会展平所有内容,并为您构建展平的字段名称):
$ mlr --prepipe 'jq ".[]"' --ijson --jflatsep __ --ocsv --quote-all cat file.json
"accept_vpc_info__tenant_id","accept_vpc_info__vpc_id","created_at","description","id","name","request_vpc_info__tenant_id","request_vpc_info__vpc_id","status","updated_at"
"184a5","0d11f","2018-11-07T08:53:43","","0b19d","NAME1","08a7b","1645f","ACTIVE","2018-11-07T09:47:44"
"067eb","17944","2019-06-12T08:29:08","","0d34a","NAME2","0fd7b","102c9","ACTIVE","2019-06-12T12:04:56"
"0ae21","071c4","2019-02-21T09:07:35","","173e2","NAME3","05a21","0586e","ACTIVE","2019-02-21T09:10:41"
答案4
这个问题比看起来容易得多,在一般情况下只需通过以下方法即可解决运行jq
两次。
考虑以下管道:
VOICES="$(aws polly describe-voices)"
jq -r -s --argfile e <(echo "$VOICES" |\
jq '.[][] | select(.["SupportedEngines"][] == "neural") | to_entries')\
'[$e[0][].key], ($e[($e | keys)[]]|[.[].value|tostring]) | @tsv' <<< "$VOICES"
例如:
{
"Voices": [
{
"Gender": "Male",
"Id": "Kevin",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Kevin",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Filiz",
"LanguageCode": "tr-TR",
"LanguageName": "Turkish",
"Name": "Filiz",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Elin",
"LanguageCode": "sv-SE",
"LanguageName": "Swedish",
"Name": "Elin",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Astrid",
"LanguageCode": "sv-SE",
"LanguageName": "Swedish",
"Name": "Astrid",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Tatyana",
"LanguageCode": "ru-RU",
"LanguageName": "Russian",
"Name": "Tatyana",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Maxim",
"LanguageCode": "ru-RU",
"LanguageName": "Russian",
"Name": "Maxim",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Carmen",
"LanguageCode": "ro-RO",
"LanguageName": "Romanian",
"Name": "Carmen",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Ines",
"LanguageCode": "pt-PT",
"LanguageName": "Portuguese",
"Name": "Inês",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Cristiano",
"LanguageCode": "pt-PT",
"LanguageName": "Portuguese",
"Name": "Cristiano",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Vitoria",
"LanguageCode": "pt-BR",
"LanguageName": "Brazilian Portuguese",
"Name": "Vitória",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Ricardo",
"LanguageCode": "pt-BR",
"LanguageName": "Brazilian Portuguese",
"Name": "Ricardo",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Camila",
"LanguageCode": "pt-BR",
"LanguageName": "Brazilian Portuguese",
"Name": "Camila",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Maja",
"LanguageCode": "pl-PL",
"LanguageName": "Polish",
"Name": "Maja",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Jan",
"LanguageCode": "pl-PL",
"LanguageName": "Polish",
"Name": "Jan",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Jacek",
"LanguageCode": "pl-PL",
"LanguageName": "Polish",
"Name": "Jacek",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Ewa",
"LanguageCode": "pl-PL",
"LanguageName": "Polish",
"Name": "Ewa",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Ola",
"LanguageCode": "pl-PL",
"LanguageName": "Polish",
"Name": "Ola",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Ruben",
"LanguageCode": "nl-NL",
"LanguageName": "Dutch",
"Name": "Ruben",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Lotte",
"LanguageCode": "nl-NL",
"LanguageName": "Dutch",
"Name": "Lotte",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Laura",
"LanguageCode": "nl-NL",
"LanguageName": "Dutch",
"Name": "Laura",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Ida",
"LanguageCode": "nb-NO",
"LanguageName": "Norwegian",
"Name": "Ida",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Liv",
"LanguageCode": "nb-NO",
"LanguageName": "Norwegian",
"Name": "Liv",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Seoyeon",
"LanguageCode": "ko-KR",
"LanguageName": "Korean",
"Name": "Seoyeon",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Kazuha",
"LanguageCode": "ja-JP",
"LanguageName": "Japanese",
"Name": "Kazuha",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Tomoko",
"LanguageCode": "ja-JP",
"LanguageName": "Japanese",
"Name": "Tomoko",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Takumi",
"LanguageCode": "ja-JP",
"LanguageName": "Japanese",
"Name": "Takumi",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Mizuki",
"LanguageCode": "ja-JP",
"LanguageName": "Japanese",
"Name": "Mizuki",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Bianca",
"LanguageCode": "it-IT",
"LanguageName": "Italian",
"Name": "Bianca",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Giorgio",
"LanguageCode": "it-IT",
"LanguageName": "Italian",
"Name": "Giorgio",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Carla",
"LanguageCode": "it-IT",
"LanguageName": "Italian",
"Name": "Carla",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Karl",
"LanguageCode": "is-IS",
"LanguageName": "Icelandic",
"Name": "Karl",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Dora",
"LanguageCode": "is-IS",
"LanguageName": "Icelandic",
"Name": "Dóra",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Mathieu",
"LanguageCode": "fr-FR",
"LanguageName": "French",
"Name": "Mathieu",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Lea",
"LanguageCode": "fr-FR",
"LanguageName": "French",
"Name": "Léa",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Celine",
"LanguageCode": "fr-FR",
"LanguageName": "French",
"Name": "Céline",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Chantal",
"LanguageCode": "fr-CA",
"LanguageName": "Canadian French",
"Name": "Chantal",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Gabrielle",
"LanguageCode": "fr-CA",
"LanguageName": "Canadian French",
"Name": "Gabrielle",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Penelope",
"LanguageCode": "es-US",
"LanguageName": "US Spanish",
"Name": "Penélope",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Miguel",
"LanguageCode": "es-US",
"LanguageName": "US Spanish",
"Name": "Miguel",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Lupe",
"LanguageCode": "es-US",
"LanguageName": "US Spanish",
"Name": "Lupe",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Mia",
"LanguageCode": "es-MX",
"LanguageName": "Mexican Spanish",
"Name": "Mia",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Lucia",
"LanguageCode": "es-ES",
"LanguageName": "Castilian Spanish",
"Name": "Lucia",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Enrique",
"LanguageCode": "es-ES",
"LanguageName": "Castilian Spanish",
"Name": "Enrique",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Conchita",
"LanguageCode": "es-ES",
"LanguageName": "Castilian Spanish",
"Name": "Conchita",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Geraint",
"LanguageCode": "en-GB-WLS",
"LanguageName": "Welsh English",
"Name": "Geraint",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Salli",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Salli",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Matthew",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Matthew",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Kimberly",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Kimberly",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Kendra",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Kendra",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Justin",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Justin",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Joey",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Joey",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Joanna",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Joanna",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Ivy",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Ivy",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Aria",
"LanguageCode": "en-NZ",
"LanguageName": "New Zealand English",
"Name": "Aria",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Ayanda",
"LanguageCode": "en-ZA",
"LanguageName": "South African English",
"Name": "Ayanda",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Raveena",
"LanguageCode": "en-IN",
"LanguageName": "Indian English",
"Name": "Raveena",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Aditi",
"LanguageCode": "en-IN",
"LanguageName": "Indian English",
"Name": "Aditi",
"AdditionalLanguageCodes": [
"hi-IN"
],
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Emma",
"LanguageCode": "en-GB",
"LanguageName": "British English",
"Name": "Emma",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Brian",
"LanguageCode": "en-GB",
"LanguageName": "British English",
"Name": "Brian",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Amy",
"LanguageCode": "en-GB",
"LanguageName": "British English",
"Name": "Amy",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Male",
"Id": "Russell",
"LanguageCode": "en-AU",
"LanguageName": "Australian English",
"Name": "Russell",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Nicole",
"LanguageCode": "en-AU",
"LanguageName": "Australian English",
"Name": "Nicole",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Olivia",
"LanguageCode": "en-AU",
"LanguageName": "Australian English",
"Name": "Olivia",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Vicki",
"LanguageCode": "de-DE",
"LanguageName": "German",
"Name": "Vicki",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Marlene",
"LanguageCode": "de-DE",
"LanguageName": "German",
"Name": "Marlene",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Hans",
"LanguageCode": "de-DE",
"LanguageName": "German",
"Name": "Hans",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Naja",
"LanguageCode": "da-DK",
"LanguageName": "Danish",
"Name": "Naja",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Male",
"Id": "Mads",
"LanguageCode": "da-DK",
"LanguageName": "Danish",
"Name": "Mads",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Gwyneth",
"LanguageCode": "cy-GB",
"LanguageName": "Welsh",
"Name": "Gwyneth",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Zhiyu",
"LanguageCode": "cmn-CN",
"LanguageName": "Chinese Mandarin",
"Name": "Zhiyu",
"SupportedEngines": [
"neural",
"standard"
]
},
{
"Gender": "Female",
"Id": "Zeina",
"LanguageCode": "arb",
"LanguageName": "Arabic",
"Name": "Zeina",
"SupportedEngines": [
"standard"
]
},
{
"Gender": "Female",
"Id": "Hala",
"LanguageCode": "ar-AE",
"LanguageName": "Gulf Arabic",
"Name": "Hala",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Arlet",
"LanguageCode": "ca-ES",
"LanguageName": "Catalan",
"Name": "Arlet",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Hannah",
"LanguageCode": "de-AT",
"LanguageName": "German",
"Name": "Hannah",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Ruth",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Ruth",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Stephen",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Name": "Stephen",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Kajal",
"LanguageCode": "en-IN",
"LanguageName": "Indian English",
"Name": "Kajal",
"AdditionalLanguageCodes": [
"hi-IN"
],
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Hiujin",
"LanguageCode": "yue-CN",
"LanguageName": "Cantonese",
"Name": "Hiujin",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Female",
"Id": "Suvi",
"LanguageCode": "fi-FI",
"LanguageName": "Finnish",
"Name": "Suvi",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Arthur",
"LanguageCode": "en-GB",
"LanguageName": "British English",
"Name": "Arthur",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Daniel",
"LanguageCode": "de-DE",
"LanguageName": "German",
"Name": "Daniel",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Liam",
"LanguageCode": "fr-CA",
"LanguageName": "Canadian French",
"Name": "Liam",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Pedro",
"LanguageCode": "es-US",
"LanguageName": "US Spanish",
"Name": "Pedro",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Sergio",
"LanguageCode": "es-ES",
"LanguageName": "Castilian Spanish",
"Name": "Sergio",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Andres",
"LanguageCode": "es-MX",
"LanguageName": "Mexican Spanish",
"Name": "Andrés",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Remi",
"LanguageCode": "fr-FR",
"LanguageName": "French",
"Name": "Rémi",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Adriano",
"LanguageCode": "it-IT",
"LanguageName": "Italian",
"Name": "Adriano",
"SupportedEngines": [
"neural"
]
},
{
"Gender": "Male",
"Id": "Thiago",
"LanguageCode": "pt-BR",
"LanguageName": "Brazilian Portuguese",
"Name": "Thiago",
"SupportedEngines": [
"neural"
]
}
]
}
产量:
Gender Id LanguageCode LanguageName Name SupportedEngines
Male Kevin en-US US English Kevin ["neural"]
Female Elin sv-SE Swedish Elin ["neural"]
Female Ines pt-PT Portuguese Inês ["neural","standard"]
Female Vitoria pt-BR Brazilian Portuguese Vitória ["neural","standard"]
Female Camila pt-BR Brazilian Portuguese Camila ["neural","standard"]
Female Ola pl-PL Polish Ola ["neural"]
Female Laura nl-NL Dutch Laura ["neural"]
Female Ida nb-NO Norwegian Ida ["neural"]
Female Seoyeon ko-KR Korean Seoyeon ["neural","standard"]
Female Kazuha ja-JP Japanese Kazuha ["neural"]
Female Tomoko ja-JP Japanese Tomoko ["neural"]
Male Takumi ja-JP Japanese Takumi ["neural","standard"]
Female Bianca it-IT Italian Bianca ["neural","standard"]
Female Lea fr-FR French Léa ["neural","standard"]
Female Gabrielle fr-CA Canadian French Gabrielle ["neural"]
Female Lupe es-US US Spanish Lupe ["neural","standard"]
Female Mia es-MX Mexican Spanish Mia ["neural","standard"]
Female Lucia es-ES Castilian Spanish Lucia ["neural","standard"]
Female Salli en-US US English Salli ["neural","standard"]
Male Matthew en-US US English Matthew ["neural","standard"]
Female Kimberly en-US US English Kimberly ["neural","standard"]
Female Kendra en-US US English Kendra ["neural","standard"]
Male Justin en-US US English Justin ["neural","standard"]
Male Joey en-US US English Joey ["neural","standard"]
Female Joanna en-US US English Joanna ["neural","standard"]
Female Ivy en-US US English Ivy ["neural","standard"]
Female Aria en-NZ New Zealand English Aria ["neural"]
Female Ayanda en-ZA South African English Ayanda ["neural"]
Female Emma en-GB British English Emma ["neural","standard"]
Male Brian en-GB British English Brian ["neural","standard"]
Female Amy en-GB British English Amy ["neural","standard"]
Female Olivia en-AU Australian English Olivia ["neural"]
Female Vicki de-DE German Vicki ["neural","standard"]
Female Zhiyu cmn-CN Chinese Mandarin Zhiyu ["neural","standard"]
Female Hala ar-AE Gulf Arabic Hala ["neural"]
Female Arlet ca-ES Catalan Arlet ["neural"]
Female Hannah de-AT German Hannah ["neural"]
Female Ruth en-US US English Ruth ["neural"]
Male Stephen en-US US English Stephen ["neural"]
Female Kajal en-IN Indian English Kajal ["hi-IN"] ["neural"]
Female Hiujin yue-CN Cantonese Hiujin ["neural"]
Female Suvi fi-FI Finnish Suvi ["neural"]
Male Arthur en-GB British English Arthur ["neural"]
Male Daniel de-DE German Daniel ["neural"]
Male Liam fr-CA Canadian French Liam ["neural"]
Male Pedro es-US US Spanish Pedro ["neural"]
Male Sergio es-ES Castilian Spanish Sergio ["neural"]
Male Andres es-MX Mexican Spanish Andrés ["neural"]
Male Remi fr-FR French Rémi ["neural"]
Male Adriano it-IT Italian Adriano ["neural"]
Male Thiago pt-BR Brazilian Portuguese Thiago ["neural"]
第一个jq
命令过滤输入 JSON 数据以仅选择SupportedEngines
包含"neural"
.to_entries
转换为键值对数组。
生成的数组存储在 中,该数组通过此处文件$e
传递给第二个数组。jq
这个“外部”jq
首先选择数组中第一个对象的键$e
,这些键保证是 TSV 输出的标头。
然后,它选择 $e 中每个对象的值,使用tostring
(在我们的示例中仅需要一行)将它们转换为字符串,并将它们格式化为@tsv
.