在 Ubuntu 10.04 上安装 jq JSON 处理器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33184780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install jq JSON processor on Ubuntu 10.04
提问by Ste-3PO
Is there a way to install jq JSON processor on Ubuntu 10.04?
有没有办法在 Ubuntu 10.04 上安装 jq JSON 处理器?
I Tried the usual sudo apt-get install jqbut got the error E: Couldn't find package jq
我尝试了通常的sudo apt-get install jq但得到了错误E: Couldn't find package jq
回答by StefanJCollier
It is possible to perform sudo apt-get install jqhowever you need to inform the system where to find jq.
可以执行sudo apt-get install jq但是您需要通知系统在哪里可以找到 jq。
?? Note: Ubuntu 14+ users can skip to step 4!
?? 注意:Ubuntu 14+ 用户可以跳到第 4 步!
Install
安装
Open your sources file in a text editor:
sudo vim /etc/apt/sources.listAdd the following line to the end of that file (note
debis not a command, more info):deb http://us.archive.ubuntu.com/ubuntuvivid main universe
Then re-index apt-get so that it can find
jq:sudo apt-get updateThen do the normal install and you should be the proud new user of
jq!sudo apt-get install jq
在文本编辑器中打开源文件:
sudo vim /etc/apt/sources.list将以下行添加到该文件的末尾(注意
deb不是命令,更多信息):deb http://us.archive.ubuntu.com/ubuntu生动的主宇宙
然后重新索引 apt-get 以便它可以找到
jq:sudo apt-get update然后进行正常安装,您应该是
jq!sudo apt-get install jq
Test
测试
Test it works! Try this to see it pretty print some example json
测试它是否有效!试试这个看看它漂亮地打印了一些示例 json
echo '{ "name":"John", "age":31, "city":"New York" }' | jq .
The result should appear like so in your terminal:
结果应该在您的终端中显示如下:
{
"name": "John",
"age": 31,
"city": "New York"
}
回答by Nik
回答by Somaiah Kumbera
I think you're missing the repo: http://installion.co.uk/ubuntu/vivid/universe/j/jq/install/index.html
我认为你错过了回购:http: //installion.co.uk/ubuntu/vivid/universe/j/jq/install/index.html
回答by Hans Z.
Download & build from source as described in https://stedolan.github.io/jq/download/, last section called "From source on Linux, OS X, Cygwin, and other POSIX-like operating systems".
从源代码下载和构建,如https://stedolan.github.io/jq/download/ 中所述,最后一节称为“从 Linux、OS X、Cygwin 和其他类似 POSIX 的操作系统上的源代码”。

