Reputation: 649
I am trying to display only lines with second value greater than 1000. The original JQ program I am using to display everything is:
jq -r '.[] | [.name, .size] | join(",")' file.json
This gives me:
name1,1024
name2,300
name3,512
If I select values only greater than 1000:
jq -r '.[] | [.name, .size | select(. > 1000)] | join(",")' file.json
then I am getting:
name1,1024
name2
name3
How can I discard lines with size less than 1000?
Upvotes: 6
Views: 4434
Reputation: 50775
Select objects, not fields.
.[] | select(.size > 1000) | [.name, .size] | join(",")
Upvotes: 10