5 ms·
I found jq the other day (http://stedolan.github.io/jq/ http://stedolan.github.io/jq/), which is a commandline utility for manipulating json data, resembling aw
by oxymoron 13y ago
I found jq the other day (http://stedolan.github.io/jq/ http://stedolan.github.io/jq/), which is a commandline utility for manipulating json data, resembling awk.
Considering the number of API's that return json data these days, it's simplified my life a great deal. It's proven especially useful for automation shell scripts, when working with things like the aws command line client that return all results as json. Usually I'm looking to extract something like a single field to use as input for a following command, and jq makes it really easy. No more inline python or awkward sed regex's. :)
It's available using apt-get on debian/ubuntu, but that version is out of date with the online docs. It's rather trivial to build from source though (it has no external deps).
- brokentone 13y ago+1 for jq. Lifechanging. I had to build it on CentOS6, but as you said, super easy.
- jalkjaer 13y agoxmlstarlet does similar things for xml
- shadowfox 13y agoOn a similar note, there is also csvkit [1] for csv files. It is not quite as full featured as I had like, but it is easier than manipulating csv content directly via cut/column/grep/sed. [1] http://csvkit.readthedocs.org/en/latest/index.html http://csvkit.readthedocs.org/en/latest/index.html
- pessimizer 13y agotry csvfix: http://csvfix.byethost5.com/csvfix15/csvfix.html http://csvfix.byethost5.com/csvfix15/csvfix.html
- hrez 13y agoWith aws cli you don`t need jq. Read on --query option. http://docs.aws.amazon.com/cli/latest/userguide/controlling-output.html#d0e1545 http://docs.aws.amazon.com/cli/latest/userguide/controlling-...