Spec-Zone.ru › Nushell

find for filters

Search for terms in the input data.

Signature

> find {flags} ...rest

Flags

  • --regex, -r {string}: Regex to match with.
  • --ignore-case, -i: Case-insensitive; when in regex mode, this is equivalent to (?i).
  • --multiline, -m: Don't split multi-line strings into lists of lines. you should use this option when using the (?m) or (?s) flags in regex mode.
  • --dotall, -s: Dotall regex mode: allow a dot . to match newlines \n; equivalent to (?s).
  • --columns, -c {list<string>}: Column names to be searched.
  • --no-highlight, -n: No-highlight mode: find without marking with ansi code.
  • --invert, -v: Invert the match.
  • --rfind, -R: Search from the end of the string and only return the first match.

Parameters

  • ...rest: Terms to search.

Input/output types:

input output
list<any> list<any>
string any

Examples

Search for multiple terms in a command output.

> ls | find toml md sh

Search and highlight text for a term in a string.

> 'Cargo.toml' | find Cargo
Cargo.toml

Search a number or a file size in a list of numbers.

> [1 5 3kb 4 35 3Mb] | find 5 3kb
╭───┬────────╮
│ 0 │      5 │
│ 1 │ 3.0 kB │
╰───┴────────╯

Search a char in a list of string.

> [moe larry curly] | find l
╭───┬───────╮
│ 0 │ larry │
│ 1 │ curly │
╰───┴───────╯

Search using regex.

> [abc odb arc abf] | find --regex "b."
╭───┬─────╮
│ 0 │ abc │
│ 1 │ abf │
╰───┴─────╯

Case insensitive search.

> [aBc bde Arc abf] | find "ab" -i
╭───┬─────╮
│ 0 │ aBc │
│ 1 │ abf │
╰───┴─────╯

Find value in records using regex.

> [[version name]; ['0.1.0' nushell] ['0.1.1' fish] ['0.2.0' zsh]] | find --regex "nu"
╭───┬─────────┬─────────╮
│ # │ version │  name   │
├───┼─────────┼─────────┤
│ 0 │ 0.1.0   │ nushell │
╰───┴─────────┴─────────╯

Find inverted values in records using regex.

> [[version name]; ['0.1.0' nushell] ['0.1.1' fish] ['0.2.0' zsh]] | find --regex "nu" --invert
╭───┬─────────┬──────╮
│ # │ version │ name │
├───┼─────────┼──────┤
│ 0 │ 0.1.1   │ fish │
│ 1 │ 0.2.0   │ zsh  │
╰───┴─────────┴──────╯

Find value in list using regex.

> [["Larry", "Moe"], ["Victor", "Marina"]] | find --regex "rr"
╭───┬───────────────╮
│ 0 │ ╭───┬───────╮ │
│   │ │ 0 │ Larry │ │
│   │ │ 1 │ Moe   │ │
│   │ ╰───┴───────╯ │
╰───┴───────────────╯

Find inverted values in records using regex.

> [["Larry", "Moe"], ["Victor", "Marina"]] | find --regex "rr" --invert
╭───┬────────────────╮
│ 0 │ ╭───┬────────╮ │
│   │ │ 0 │ Victor │ │
│   │ │ 1 │ Marina │ │
│   │ ╰───┴────────╯ │
╰───┴────────────────╯

Remove ANSI sequences from result.

> [[foo bar]; [abc 123] [def 456]] | find --no-highlight 123
╭───┬─────┬─────╮
│ # │ foo │ bar │
├───┼─────┼─────┤
│ 0 │ abc │ 123 │
╰───┴─────┴─────╯

Find and highlight text in specific columns.

> [[col1 col2 col3]; [moe larry curly] [larry curly moe]] | find moe --columns [col1]
╭───┬──────┬───────┬───────╮
│ # │ col1 │ col2  │ col3  │
├───┼──────┼───────┼───────┤
│ 0 │ moe  │ larry │ curly │
╰───┴──────┴───────┴───────╯

Find in a multi-line string.

> 'Violets are red
And roses are blue
When metamaterials
Alter their hue' | find ue
╭───┬────────────────────╮
│ 0 │ And roses are blue │
│ 1 │ Alter their hue    │
╰───┴────────────────────╯

Find in a multi-line string without splitting the input into a list of lines.

> 'Violets are red
And roses are blue
When metamaterials
Alter their hue' | find --multiline ue
Violets are red
And roses are blue
When metamaterials
Alter their hue

Find and highlight the last occurrence in a string.

> 'hello world hello' | find --rfind hello
hello world hello

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

Spec-Zone.ru

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