Spec-Zone.ru › Nushell

reject for filters

Remove the given columns or rows from the table. Opposite of `select`.

Signature

> reject {flags} ...rest

Flags

  • --optional, -o: Make all cell path members optional.
  • --ignore-case: Make all cell path members case insensitive.
  • --ignore-errors, -i: Ignore missing data (make all cell path members optional) (deprecated).

Parameters

  • ...rest: The names of columns to remove from the table.

Input/output types:

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

Examples

Reject a column in the ls table.

> ls | reject modified

Reject a column in a table.

> [[a, b]; [1, 2]] | reject a
╭───┬───╮
│ # │ b │
├───┼───┤
│ 0 │ 2 │
╰───┴───╯

Reject a row in a table.

> [[a, b]; [1, 2] [3, 4]] | reject 1
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 2 │
╰───┴───┴───╯

Reject the specified field in a record.

> {a: 1, b: 2} | reject a
╭───┬───╮
│ b │ 2 │
╰───┴───╯

Reject a nested field in a record.

> {a: {b: 3, c: 5}} | reject a.b
╭───┬───────────╮
│   │ ╭───┬───╮ │
│ a │ │ c │ 5 │ │
│   │ ╰───┴───╯ │
╰───┴───────────╯

Reject multiple rows.

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb] [file.json json 3kb]] | reject 0 2

Reject multiple columns.

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject type size
╭───┬────────────╮
│ # │    name    │
├───┼────────────┤
│ 0 │ Cargo.toml │
│ 1 │ Cargo.lock │
╰───┴────────────╯

Reject multiple columns by spreading a list.

> let cols = [type size]; [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject ...$cols
╭───┬────────────╮
│ # │    name    │
├───┼────────────┤
│ 0 │ Cargo.toml │
│ 1 │ Cargo.lock │
╰───┴────────────╯

Reject item in list.

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

Notes

To remove a quantity of rows or columns, use skip, drop, or drop column. To keep/retain only specific columns, use select.

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/reject.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API