bytes remove for bytes

Remove bytes.

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:

inputoutput
binarybinary
recordrecord
tabletable

Examples

Remove contents

> 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

> { data: 0x[10 AA 10 BB 10] } | bytes remove --all 0x[10] data
╭──────┬────────────╮
 data [170, 187] 
╰──────┴────────────╯

Remove occurrences of find binary from end

> 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

> 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

> [[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] 
╰───┴──────────┴──────────────┴──────────────╯