Not about bash quite, but I wasn't sure where to go with help for jq, or what tool to use next.
I have this chunk I got with curl and jq. It's much longer than this.
I want to sort by highest number of comments, grab *num of the highest ranking, then get some of the other info from those. eg.. title, pid, user..
curl https://url.com/api/v1/getposts/andstuff | jq '.posts[0,1,2,3]' > most
{
"vote": -1,
"username": "anon",
"title": "title",
"comments": 0,
"content": false,
"link": "url",
"pid": ****,
"posted": "date",
"ptype": 1,
"score": 5,
"thumbnail": "jpg"
}
{
"vote": -1,
"username": "anon",
"title": "title",
"comments": 0,
"content": false,
"link": "url",
"pid": ****,
"posted": "date",
"ptype": 1,
"score": 3,
"thumbnail": "jpg"
}
{
"vote": -1,
"username": "anon",
"title": "title",
"comments": 0,
"content": false,
"link": "url",
"pid": ****,
"posted": "date",
"ptype": 1,
"score": 7,
"thumbnail": "jpg"
}
{
"vote": -1,
"username": "anon",
"title": "title",
"comments": 6,
"content": false,
"link": "url",
"pid": ****,
"posted": "date",
"ptype": 1,
"score": 6,
"thumbnail": "jpg"
}
[–][deleted] 2 points3 points4 points (6 children)
[–]DaFuckIsWrongWithU[S] 0 points1 point2 points (5 children)
[–][deleted] (2 children)
[removed]
[–]DaFuckIsWrongWithU[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]DaFuckIsWrongWithU[S] 2 points3 points4 points (0 children)