computer_knowledge_notes/Software/文本转换/jq.md

21 lines
426 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```
jq [options] <filter> [files] # 处理json
```
#### filters
```
. # 不加修改地把输入复制到输出
```
#### 选项
```
--arg a v # 将变量$a的值设为v
-r # 输出原始字符串(如不加此选项默认输出json文本)
-s # 把所有输入都读到数组里并把filter作用于此数组
```
#### 参考
[jq 的使用介绍](https://www.ibm.com/developerworks/cn/linux/1612_chengg_jq/index.html)