Home Explore Blog CI



nushell

commands/docs/bytes_remove.md
e11b681719a4e50a0ad7011fb28f57567b57e66177e07cfd00000003000009de
---
title: bytes remove
categories: |
  bytes
version: 0.104.0
bytes: |
  Remove bytes.
usage: |
  Remove bytes.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

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

<div class='command-title'>Remove bytes.</div>

## Signature

```> bytes remove {flags} (pattern) ...rest```

## Flags

 -  `--end, -e`: remove from end of binary
 -  `--all, -a`: remove occurrences of finding binary

## Parameters

 -  `pattern`: The pattern to find.
 -  `...rest`: For a data structure input, remove bytes from data at the given cell paths.


## Input/output types:

| input  | output |
| ------ | ------ |
| binary | binary |
| record | record |
| table  | table  |
## Examples

Remove contents
```nu
> 0x[10 AA FF AA FF] | bytes remove 0x[10 AA]
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   ff aa ff                                             ×××

```

Remove all occurrences of find binary in record field
```nu
> { data: 0x[10 AA 10 BB 10] } | bytes remove --all 0x[10] data
╭──────┬────────────╮
│ data │ [170, 187] │
╰──────┴────────────╯
```

Remove occurrences of find binary from end
```nu
> 0x[10 AA 10 BB CC AA 10] | bytes remove --end 0x[10]
Length: 6 (0x6) bytes | printable whitespace ascii_other non_ascii
00000000:   10 aa 10 bb  cc aa                                   •ו×××

```

Remove find binary from end not found
```nu
> 0x[10 AA 10 BB CC AA 10] | bytes remove --end 0x[11]
Length: 7 (0x7) bytes | printable whitespace ascii_other non_ascii
00000000:   10 aa 10 bb  cc aa 10                                •ו××ו

```

Remove all occurrences of find binary in table
```nu
> [[ColA ColB ColC]; [0x[11 12 13] 0x[14 15 16] 0x[17 18 19]]] | bytes remove 0x[11] ColA ColC
╭───┬──────────┬──────────────┬──────────────╮
│ # │   ColA   │     ColB     │     ColC     │
├───┼──────────┼──────────────┼──────────────┤
│ 0 │ [18, 19] │ [20, 21, 22] │ [23, 24, 25] │
╰───┴──────────┴──────────────┴──────────────╯

```

Chunks
392a9d67 (1st chunk of `commands/docs/bytes_remove.md`)
Title: bytes remove
Summary
This command removes bytes from binary data. It can remove the first occurrence of a pattern, all occurrences, or occurrences from the end of the binary. It also supports removing bytes from specific fields within records or tables.