Question: I want to use jq to check if a keyword exists as a key in a JSON at any level. Here is what I came up with:

```
jq -c 'paths | select(.[-1]) as $p| index("headline") //empty' news.json

```

The output is an array:

```
[
  6,
  7,
  9
]

```

I want to map the output array to jq function `any()` and get an overall result as true if key exists or false if it doesn't.

How can I get that done with jq ?

Answer: 
You can use `grep -o` to print only the matched phrase. Also use `-F` to make sure that it matches literal characters instead of a regex where `.` and `-` are special

```
if [[ $(echo "$br_name" | grep -Fo ge-0.0.3 | wc -l) -gt 1 ]]; then
    echo "ge-0.0.3 is shown more than once"
else
    echo "only once"
fi

```

For more complex patterns of course you can drop `-F` and write a proper regex for `grep`
Assuming you want to do a literal string match on whole words, not substrings, then this might be what you want:

```
$ if (( $(grep -oFw 'ge-0.0.3' <<<"$br_name" | wc -l) > 1 )); then echo 'yes'; else echo 'no'; fi
yes

```