I have the following json file:
{
"aNo": 66,
"name": "Fella"
}
{
"aNo": 77,
"name": "Bella"
}
I am trying to select the name of entry which has aNo = 66 without success. However the vice versa is working, I am using this example :
cat file.json | jq '.[] | select(.name=="Fella")
It works, I get the whole key :
{
"aNo": 66,
"name": "Fella"
}
Now what I am asking about, is :
- How to get the key based on aNo?
- How to get only the name without any other values in the result.
- Why I can't pipeline jq results ?? I get error messages when I do.
Thank you all for your great help !