Skip to main content
Version: v1.4.0

tail

Operator

tail copy trailing values of input sequence

Synopsis

tail [ n ]

Description

The tail operator copies the last n values from its input to its output and ends the sequence thereafter. n must be an integer.

Examples

Grab last two values of arbitrary sequence

echo '1 "foo" [1,2,3]' | zq -z 'tail 2' -

=>

"foo"
[1,2,3]

Grab the last record of a record sequence

echo '{a:"hello"}{b:"world"}' | zq -z tail -

=>

{b:"world"}