skip until

For filters.

Skip elements of the input until a predicate is true.

Command Type

built-in

Signature

> skip until {flags} (predicate)

Parameters

  • predicate: The predicate that skipped element must not match.

Input/output types:

input output
table table
list<any> list<any>

Examples

Skip until the element is positive.

> [-2 0 2 -1] | skip until {|x| $x > 0 }
╭───┬────╮
│ 0 │  2 │
│ 1 │ -1 │
╰───┴────╯

Skip until the element is positive using stored condition.

> let cond = {|x| $x > 0 }; [-2 0 2 -1] | skip until $cond
╭───┬────╮
│ 0 │  2 │
│ 1 │ -1 │
╰───┴────╯

Skip until the field value is positive.

> [{a: -2} {a: 0} {a: 2} {a: -1}] | skip until {|x| $x.a > 0 }
╭───┬────╮
│ # │ a  │
├───┼────┤
│ 0 │  2 │
│ 1 │ -1 │
╰───┴────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.