Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Deprecated
    • Env
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
binarybinary
list<binary>list<binary>
recordrecord
tabletable

Examples

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

>  0x[33 44 55 10 01 13] | bytes at 3..<4
Length: 1 (0x1) bytes | printable whitespace ascii_other non_ascii
00000000:   10                                                   •

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

>  0x[33 44 55 10 01 13] | bytes at 3..6
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   10 01 13                                             •••

Get the remaining characters from a starting index

>  { data: 0x[33 44 55 10 01 13] } | bytes at 3.. data
╭──────┬─────────────╮
│ data │ [16, 1, 19] │
╰──────┴─────────────╯

Get the characters from the beginning until ending index

>  0x[33 44 55 10 01 13] | bytes at ..<4
Length: 4 (0x4) bytes | printable whitespace ascii_other non_ascii
00000000:   33 44 55 10                                          3DU•

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

>  [[ColA ColB ColC]; [0x[11 12 13] 0x[14 15 16] 0x[17 18 19]]] | bytes at 1.. ColB ColC
╭───┬──────────────┬──────────┬──────────╮
│ # │     ColA     │   ColB   │   ColC   │
├───┼──────────────┼──────────┼──────────┤
│ 0 │ [17, 18, 19] │ [21, 22] │ [24, 25] │
╰───┴──────────────┴──────────┴──────────╯
Edit this page on GitHub
Contributors: Justin Ma, Leon, Hofer-Julian, Texas Toland, sholderbach