There is a json document which contains an array of strings. e.g.
["abc","xabc","abcd","xyz"]via jq i want to count the items that start with a string. f.e. abc
I would expect that
jq -c '.[] | select(startswith("abc"))' | wc -l | xargs
return 2 but it throws an error: jq: error: startwith/1 is not defined at <top-level>, line 1
The similar request with contains instead of startswith
jq -c '.[] | select(contains("abc"))' | wc -l | xargs returns 3 (what is correct, for contains)