tencent cloud

Tencent Cloud Command Line Interface

Product Introduction
Purchase Guide
Operation Guide
Installing TCCLI
Configuring TCCLI
Using TCCLI

Filtering Return Results

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-08-19 16:07:03
Some commands return much information in the output. You can filter the information as required.

Directions

This document describes how different filtering methods are used and their corresponding outcomes. The DescribeZones API of Cloud Virtual Machine (CVM) is used as an example in this document.
View the unfiltered output.
[root@VM_180_248_centos ~]# tccli cvm DescribeZones
{
"TotalCount": 3,
"ZoneSet": [
{
"ZoneState": "AVAILABLE",
"ZoneId": "100001",
"Zone": "ap-guangzhou-1",
"ZoneName": "Guangzhou Zone 1"
},
{
"ZoneState": "AVAILABLE",
"ZoneId": "100003",
"Zone": "ap-guangzhou-3",
"ZoneName": "Guangzhou Zone 3"
},
{
"ZoneState": "AVAILABLE",
"ZoneId": "100004",
"Zone": "ap-guangzhou-4",
"ZoneName": "Guangzhou Zone 4"
}
],
"RequestId": "4fd313a6-155f-4c7a-bf86-898c02fcae02"
}
View a specified field.
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter TotalCount
3
View the Nth sub-object of a specified object in array type.
Note:
On macOS, the error zsh: no matches found: xxx may be returned after you run the following command. To resolve this issue, enclose the filter in single quotes.
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter ZoneSet[0]
{
"ZoneState": "AVAILABLE",
"ZoneId": "100001",
"Zone": "ap-guangzhou-1",
"ZoneName": "Guangzhou Zone 1"
}
View a certain field of all the sub-objects with a certain name under the specified object in array type.
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter ZoneSet[*].ZoneName
[
"Guangzhou Zone 1",
"Guangzhou Zone 3",
"Guangzhou Zone 4"
]
Filter the sub-objects in an array and display them with a new name.
Note:
The filter must be enclosed in single quotes.
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter 'ZoneSet[*].{name:ZoneName, id:ZoneId}'
[
{
"name": "Guangzhou Zone 1",
"id": "100001"
},
{
"name": "Guangzhou Zone 3",
"id": "100003"
},
{
"name": "Guangzhou Zone 4",
"id": "100004"
}
]


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백