2026-02-01 16:33:20 -08:00
|
|
|
# In jq 1.4 or later:
|
|
|
|
|
jq -n '"abcdabcd" | indices("bc")'
|
|
|
|
|
[
|
|
|
|
|
1,
|
|
|
|
|
5
|
|
|
|
|
]
|
2023-07-01 11:58:00 -04:00
|
|
|
|
2026-02-01 16:33:20 -08:00
|
|
|
# In jq 1.5, the regex function match/1 can also be used:
|
|
|
|
|
$ jq -n '"abcdabcd" | match("bc"; "g") | .offset'
|
|
|
|
|
1
|
|
|
|
|
5
|