【问题标题】:Trouble pretty-printing large json file on linux command line with jq麻烦在 linux 命令行上使用 jq 漂亮地打印大型 json 文件
【发布时间】:2017-02-22 19:10:50
【问题描述】:

我正在尝试在命令行上使用 jq 漂亮地打印和滚动浏览一个非常大(数十 GB)的人类不可读 json 文件的部分。

less bigFile.json | jq

有效,但只是让它飞过。

我试着把它用管道换回,不像这样:

less bigFile.json | jq | less

但它产生了某种错误。

你是如何做到这一点的?

【问题讨论】:

    标签: json linux unix command-line pretty-print


    【解决方案1】:

    该命令应如下所示:

    jq -C . bigfile.json | less -r
    

    如果这耗尽了你所有的记忆,你可能想试试less-B 选项,甚至更好,使用jq 过滤掉有趣的部分。

    【讨论】:

      猜你喜欢
      • 2013-12-14
      • 1970-01-01
      • 1970-01-01
      • 2012-10-08
      • 2015-01-12
      • 2013-04-12
      • 2015-07-03
      相关资源
      最近更新 更多