【发布时间】:2020-06-09 06:29:28
【问题描述】:
我目前正在尝试从通过cURL 命令使用GET 请求获得的长字符串中过滤值。输出如下所示:
{"errors":null,"result":{"host_id":"1632","display_name":"notshownhere","hostname":"notshownhere","dnsname":"","ip":"1.1.1.1","host_type_id":"1","checks":[{"check_id":"12851","preset_id":"1","checktype_id":"1","checktype_short_name":"ping","status":"3","status_condition":"ok","status_color":"green","status_change_time":"1589066121","result_short":"1.1.1.1 is alive","result_time":"1591683892"}
我的目标是从此输出中过滤掉host_id。这意味着,我想找到一种方法,我只能输出带有数字 1632 的 host_id。
我尝试了Select-String,但由于字符串太长,它不起作用。
【问题讨论】:
标签: string powershell filter select-string