Created
February 8, 2014 15:21
-
-
Save daxanya2/8885328 to your computer and use it in GitHub Desktop.
jqのバージョンを最新にしたらjsonの処理が捗りすぎて怖い ref: http://qiita.com/daxanya1/items/6ed6b292a838ed750d35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"messages":[{"date":"2014-02-06T10:01:07+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"https:\/\/github.com\/bowery\/orcheTstrate.js"},{"date":"2014-02-06T10:01:11+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"orchestrate.js"},{"date":"2014-02-06T10:01:18+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"http:\/\/www.slideshare.net\/who_you_me\/neo4j-24294061"},{"date":"2014-02-06T10:01:22+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"\u30b0\u30e9\u30d5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u300cNeo4j\u300d\u306e \u5c0e\u5165\u306e\u5c0e\u5165"}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/stedolan/jq.git | |
$ cd jq | |
$ autoreconf -i | |
$ ./configure | |
$ make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install automake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install bison |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd /usr/local/bin | |
$ ln -s ../Cellar/bison/3.0.2/bin/bison bison | |
$ ln -s ../Cellar/bison/3.0.2/bin/yacc yacc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | .date+" "+.message' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"2014-02-06T10:01:07+0900 https://github.com/bowery/orcheTstrate.js" | |
"2014-02-06T10:01:11+0900 orchestrate.js" | |
"2014-02-06T10:01:18+0900 http://www.slideshare.net/who_you_me/neo4j-24294061" | |
"2014-02-06T10:01:22+0900 グラフデータベース「Neo4j」の 導入の導入" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq 'def a(f): f|split("T")|.[1]|split("+")|.[0]; .messages[] | a(.date)+" "+.message' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"10:01:07 https://github.com/bowery/orcheTstrate.js" | |
"10:01:11 orchestrate.js" | |
"10:01:18 http://www.slideshare.net/who_you_me/neo4j-24294061" | |
"10:01:22 グラフデータベース「Neo4j」の 導入の導入" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment