W3cubDocs

/Nushell

bytes at for bytes

Get bytes defined by a range

Signature

> bytes at {flags} (range) ...rest

Parameters

  • range: the range to get bytes
  • ...rest: for a data structure input, get bytes from data at the given cell paths

Input/output types:

input output
binary binary
list<binary> list<binary>
record record
table table

Examples

Get a subbytes 0x[10 01] from the bytes 0x[33 44 55 10 01 13]

>0x[334455100113] |bytes at3..<4
Length:1 (0x1) bytes|printablewhitespaceascii_othernon_ascii
00000000:10

Get a subbytes 0x[10 01 13] from the bytes 0x[33 44 55 10 01 13]

>0x[334455100113] |bytes at3..6
Length:3 (0x3) bytes|printablewhitespaceascii_othernon_ascii
00000000:100113•••

Get the remaining characters from a starting index

>  { data:0x[334455100113] } |bytes at3..data
╭──────┬─────────────╮
data [16, 1, 19] 
╰──────┴─────────────╯

Get the characters from the beginning until ending index

>0x[334455100113] |bytes at..<4
Length:4 (0x4) bytes|printablewhitespaceascii_othernon_ascii
00000000:334455103DU•

Or the characters from the beginning until ending index inside a table

>  [[ColAColBColC]; [0x[111213] 0x[141516] 0x[171819]]] |bytes at1..ColBColC
╭───┬──────────────┬──────────┬──────────╮
# │     ColA     │   ColB   │   ColC   │
├───┼──────────────┼──────────┼──────────┤
0 [17, 18, 19]  [21, 22]  [24, 25] 
╰───┴──────────────┴──────────┴──────────╯

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