如何使用jq提取Mozilla SSL配置中modern和intermediate下的openssl值
解决方案
你可以直接使用如下jq命令完成提取,按需选择对应场景即可:
- 单独提取modern或intermediate其中一个的openssl cipher数组
提取intermediate:jq '.configurations.intermediate.ciphers.openssl' 5.6.json
提取modern:jq '.configurations.modern.ciphers.openssl' 5.6.json - 同时提取两个配置的openssl cipher数组,结果分开输出
jq '.configurations | .modern, .intermediate | .ciphers.openssl' 5.6.json - 同时提取两个配置的openssl cipher数组,合并为单个数组输出
jq '[.configurations | .modern, .intermediate | .ciphers.openssl] | flatten' 5.6.json - 提取时保留配置类型标识,方便区分结果来源
jq '.configurations | to_entries[] | select(.key == "modern" or .key == "intermediate") | {配置类型: .key, openssl加密套件: .value.ciphers.openssl}' 5.6.json
内容的提问来源于stack exchange,提问作者Zygmunt
相关产品推荐
相关产品推荐

