Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.13 KB

File metadata and controls

68 lines (51 loc) · 2.13 KB
title bytes replace
categories bytes
version 0.113.0
bytes Find and replace bytes in binary data.
usage Find and replace bytes in binary data.
editLink false
contributors false

bytes replace for bytes

Find and replace bytes in binary data.

Signature

> bytes replace {flags} (find) (replace) ...rest

Flags

  • --all, -a: Replace all occurrences of find binary.

Parameters

  • find: The pattern to find.
  • replace: The replacement pattern.
  • ...rest: For a data structure input, replace bytes in data at the given cell paths.

Input/output types:

input output
binary binary
table table
record record

Examples

Find and replace contents.

> 0x[10 AA FF AA FF] | bytes replace 0x[10 AA] 0x[FF]
Length: 4 (0x4) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   ff ff aa ff                                          ××××

Find and replace all occurrences of find binary.

> 0x[10 AA 10 BB 10] | bytes replace --all 0x[10] 0x[A0]
Length: 5 (0x5) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   a0 aa a0 bb  a0                                      ×××××

Find and replace all occurrences of find binary in table.

> [[ColA ColB ColC]; [0x[11 12 13] 0x[14 15 16] 0x[17 18 19]]] | bytes replace --all 0x[11] 0x[13] ColA ColC
╭───┬──────────────┬──────────────┬──────────────╮
│ # │     ColA     │     ColB     │     ColC     │
├───┼──────────────┼──────────────┼──────────────┤
│ 0 │ [19, 18, 19] │ [20, 21, 22] │ [23, 24, 25] │
╰───┴──────────────┴──────────────┴──────────────╯