mirror of
https://github.com/mikefarah/yq.git
synced 2026-06-28 07:57:43 +00:00
Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/ec06083e-e20a-45d2-bf7e-4e1fa7be1073 Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
6 lines
417 B
Markdown
6 lines
417 B
Markdown
# Slice Array or String
|
|
|
|
The slice operator works on both arrays and strings. Like the `jq` equivalent, `.[10:15]` will return a subarray (or substring) of length 5, starting from index 10 inclusive, up to index 15 exclusive. Negative numbers count backwards from the end of the array or string.
|
|
|
|
You may leave out the first or second number, which will refer to the start or end of the array or string respectively.
|