bytes split

For bytes.

Split input into multiple items using a separator.

Command Type

built-in

Signature

> bytes split {flags} (separator)

Parameters

  • separator: Bytes or string that the input will be split on (must be non-empty).

Input/output types:

input output
binary list<binary>

Examples

Split a binary value using a binary separator.

> 0x[66 6F 6F 20 62 61 72 20 62 61 7A 20] | bytes split 0x[20]
╭───┬─────────────────╮
│ 0 │ [102, 111, 111] │
│ 1 │ [98, 97, 114]   │
│ 2 │ [98, 97, 122]   │
│ 3 │ []              │
╰───┴─────────────────╯

Split a binary value using a string separator.

> 0x[61 2D 2D 62 2D 2D 63] | bytes split "--"
╭───┬──────╮
│ 0 │ [97] │
│ 1 │ [98] │
│ 2 │ [99] │
╰───┴──────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.