以下是示例代码
echo '{"x" : 1}' | jq '. , .'
以上命令的输出是这样的: { " X" :1 } { " X" :1 }
我是初学者,并且没有找到关于逗号(,)操作符的详细信息 用" jq"。
运行答案 0 :(得分:2)
通过输入以下内容查看jq的手册页:
man jq
有一段关于逗号的使用,
,
If two filters are separated by a comma, then the input will be fed
into both and there will be multiple outputs: first, all of the outputs
produced by the left expression, and then all of the outputs produced
by the right. For instance, filter .foo, .bar, produces both the "foo"
fields and "bar" fields as separate outputs.
: - )
答案 1 :(得分:0)
jq
中的多个过滤器以逗号分隔。 . , .
重复输出,因为它意味着两次当前上下文。