如何顺序打印jq输出 [英] How to print jq output sequentially

查看:76
本文介绍了如何顺序打印jq输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 jq 处理JSON时,由于JSON对象太长,我经常会丢失概述。因此,类似于 jq。 |少会很好。但是,尽管上述方法可行,但 jq 的漂亮着色消失了。

When using jq to process JSON, I often lose the overview due to long JSON objects. Thus, something like jq . | less would be nice. However, although the above works, the nice coloring by jq is gone.

还有另一种读取方法 jq 的输出逐行或逐窗口输出,而不会向终端发送完整的JSON对象?

Is there another way to read jq's output line by line, or window by window, without having the terminal spammed with the full JSON object?

编辑:这对我不起作用: echo'{ hello: world}'| jq。 | less -C

推荐答案

使用jq -C(着色)选项,更多-r 更少-r

Use the jq -C (colorize) option, with more -r or less -r.

这篇关于如何顺序打印jq输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆