head
Table of Contents
Operator
head — copy leading values of input sequence
Synopsis
head [ <const-expr> ]
Description
The head
operator copies the first N values from its input to its output and ends
the sequence thereafter. N is given by <const-expr>
, a compile-time
constant expression that evaluates to a positive integer. If <const-expr>
is not provided, the value of N defaults to 1
.
Examples
Grab first two values of arbitrary sequence
head 2
1
"foo"
[1,2,3]
Loading...
Grab first two values of arbitrary sequence, using a different representation of two
head 1+1
1
"foo"
[1,2,3]
Loading...
Grab the first record of a record sequence
Error:echo '{a:"hello"}{b:"world"}' | super -z -c head -