W3cubDocs

/Nushell

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:

input output
binary binary
record record
table table

Examples

Remove contents

>0x[10AAFFAAFF] |bytes remove0x[10AA]
Length:3 (0x3) bytes|printablewhitespaceascii_othernon_ascii
00000000:ffaaff×××

Remove all occurrences of find binary in record field

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

Remove occurrences of find binary from end

>0x[10AA10BBCCAA10] |bytes remove-e0x[10]
Length:6 (0x6) bytes|printablewhitespaceascii_othernon_ascii
00000000:10aa10bbccaa•×•×××

Remove all occurrences of find binary in table

> [[ColAColBColC]; [0x[111213] 0x[141516] 0x[171819]]] |bytes remove0x[11] ColAColC
╭───┬──────────┬──────────────┬──────────────╮
# │   ColA   │     ColB     │     ColC     │
├───┼──────────┼──────────────┼──────────────┤
0 [18, 19]  [20, 21, 22]  [23, 24, 25] 
╰───┴──────────┴──────────────┴──────────────╯

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/bytes_remove.html