You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to migrate from jq to yq but somehow array slicing does not seem to work as expected, it splits and returns all characters. I tried version 4.30.8 and 4.30.7 of yq and the behavior is the same.
@mikefarah Is this a bug or am I doing something wrong?
# array slicing using jq
$ echo'{ "foo": "aa,bb,cc" }'| jq -r '.foo | split(",")[0:2]'
[
"aa",
"bb"
]
# array slicing using yq
$ echo'{ "foo": "aa,bb,cc" }'| yq e '.foo | split(",")[0:2]'
- a
- a
- ','
- b
- b
- ','
- c
- c
# splitting in yq works as expected
$ echo'{ "foo": "aa,bb,cc" }'| yq e '.foo | split(",")'
- aa
- bb
- cc
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to migrate from jq to yq but somehow array slicing does not seem to work as expected, it splits and returns all characters. I tried version 4.30.8 and 4.30.7 of yq and the behavior is the same.
@mikefarah Is this a bug or am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions