take
for filters> take {flags} (n)
n
: starting from the front, the number of elements to returninput | output |
---|---|
binary | binary |
list<any> | list<any> |
range | list<number> |
table | table |
Return the first item of a list/table
> [123] |take1
╭───┬───╮
│0│1│
╰───┴───╯
Return the first 2 items of a list/table
> [123] |take2
╭───┬───╮
│0│1│
│1│2│
╰───┴───╯
Return the first two rows of a table
> [[editions]; [2015] [2018] [2021]] |take2
╭───┬──────────╮
│# │ editions │
├───┼──────────┤
│0│2015│
│1│2018│
╰───┴──────────╯
Return the first 2 bytes of a binary value
>0x[012345] |take2
Length:2 (0x2) bytes|printablewhitespaceascii_othernon_ascii
00000000:0123•#
Return the first 3 elements of a range
>1..10|take3
╭───┬───╮
│0│1│
│1│2│
│2│3│
╰───┴───╯
name | type | usage |
---|---|---|
take until |
Builtin | Take elements of the input until a predicate is true. |
take while |
Builtin | Take elements of the input while a predicate is true. |
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/take.html