input json:
[
{
"id": "89",
"hostname": "abcd"
},
{
"id": "89",
"hostname": "babcd"
}
]
How to modify below filter to get on output only hostname beginning with "abcd"?
$ jq -r '.[]|select(.hostname | contains("abcd"))' jjjj
{
"id": "89",
"hostname": "abcd"
}
{
"id": "89",
"hostname": "babcd"
}
$ jq -r '.[]|select(.hostname | contains("^abcd"))' jjjj
$
Best Answer
Solution: