Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 1.9 KB

first.md

File metadata and controls

81 lines (60 loc) · 1.9 KB
title first
categories filters
version 0.116.0
filters Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`. For binary input, rows can also be specified as a filesize.
usage Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`. For binary input, rows can also be specified as a filesize.
editLink false
contributors false

first for filters

Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`. For binary input, rows can also be specified as a filesize.

Command Type

built-in

Signature

> first {flags} (rows)

Flags

  • --strict, -s: Throw an error if input is empty.

Parameters

  • rows: Starting from the front, the number of rows to return.

Input/output types:

input output
list<any> any
binary binary
range any

Examples

Return the first item of a list/table.

> [1 2 3] | first
1

Return the first 2 items of a list/table.

> [1 2 3] | first 2
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
╰───┴───╯

Return the first 2 bytes of a binary value.

> 0x[01 23 45] | first 2
Length: 2 (0x2) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   01 23                                                •#

Return the first item of a range.

> 1..3 | first
1

Return the first 2 bytes of a binary value, using a filesize argument.

> 0x[01 23 45] | first 2b
Length: 2 (0x2) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   01 23                                                •#