# 系统、内核版本

cat /etc/redhat-release

CentOS release 6.8 (Final)

uname -r

2.6.32-754.33.1.el6.centos.plus.x86_64

# 下载

cd /opt/

wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz

# 编译

tar -zvxf jq-1.5.tar.gz cd jq-1.5./configure --prefix=/usr/local

make && make install

# 创建软连接

ln -s /usr/local/bin/jq /usr/bin/jq1.5

# 查看版本

jq1.5 -V

 

# 测试,

cat jqtest #假设我们有一个jqtest,内容如下

[

"zhangsan",

"18"

]

 

jq1.5 'join(" ")' jqtest # 返回如下

"zhangsan 18"

 

安装可能遇到的问题:在 ./configure --prefix=/usr/local 可能报以下错configure: error: You need bison version 3.0 or greater, or use --disable-maintainer-mode.按提示加上【–disable-maintainer-mode.】即可

./configure --prefix=/usr/local --disable-maintainer-mode

查看原文