Home Explore Blog CI



nushell

commands/docs/bytes_split.md
1d1747b6bdb65a8025b1baba27a79694e8fd6beeb8bcff220000000300000564
---
title: bytes split
categories: |
  bytes
version: 0.104.0
bytes: |
  Split input into multiple items using a separator.
usage: |
  Split input into multiple items using a separator.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `bytes split` for [bytes](/commands/categories/bytes.md)

<div class='command-title'>Split input into multiple items using a separator.</div>

## 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
```nu
> 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
```nu
> 0x[61 2D 2D 62 2D 2D 63] | bytes split "--"
╭───┬──────╮
│ 0 │ [97] │
│ 1 │ [98] │
│ 2 │ [99] │
╰───┴──────╯

```

Chunks
b0acdd5c (1st chunk of `commands/docs/bytes_split.md`)
Title: bytes split command in Nushell
Summary
The `bytes split` command in Nushell splits a binary input into a list of binary values, using a specified separator (either bytes or a string). The separator must be non-empty. The documentation provides usage details, input/output types, and examples of splitting a binary value using both binary and string separators.