Home Explore Blog CI



nushell

commands/docs/find.md
1310171dbc428820fa27f9140a0ac16e78ddfa7eefcc0f01000000030000127a
---
title: find
categories: |
  filters
version: 0.104.0
filters: |
  Searches terms in the input.
usage: |
  Searches terms in the input.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `find` for [filters](/commands/categories/filters.md)

<div class='command-title'>Searches terms in the input.</div>

## Signature

```> find {flags} ...rest```

## Flags

 -  `--regex, -r {string}`: regex to match with
 -  `--ignore-case, -i`: case-insensitive regex mode; equivalent to (?i)
 -  `--multiline, -m`: multi-line regex mode: ^ and $ match begin/end of line; equivalent to (?m)
 -  `--dotall, -s`: dotall regex mode: allow a dot . to match newlines \n; equivalent to (?s)
 -  `--columns, -c {list<string>}`: column names to be searched (with rest parameter, not regex yet)
 -  `--no-highlight, -n`: no-highlight mode: find without marking with ascii code
 -  `--invert, -v`: invert the 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
```nu
> ls | find toml md sh

```

Search and highlight text for a term in a string. Note that regular search is case insensitive
```nu
> 'Cargo.toml' | find cargo
Cargo.toml
```

Search a number or a file size in a list of numbers
```nu
> [1 5 3kb 4 3Mb] | find 5 3kb
╭───┬────────╮
│ 0 │      5 │
│ 1 │ 3.0 kB │
╰───┴────────╯

```

Search a char in a list of string
```nu
> [moe larry curly] | find l
╭───┬───────╮
│ 0 │ larry │
│ 1 │ curly │
╰───┴───────╯

```

Find using regex
```nu
> [abc bde arc abf] | find --regex "ab"
╭───┬─────╮
│ 0 │ abc │
│ 1 │ abf │
╰───┴─────╯

```

Find using regex case insensitive
```nu
> [aBc bde Arc abf] | find --regex "ab" -i
╭───┬─────╮
│ 0 │ aBc │
│ 1 │ abf │
╰───┴─────╯

```

Find value in records using regex
```nu
> [[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
```nu
> [[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
```nu
> [["Larry", "Moe"], ["Victor", "Marina"]] | find --regex "rr"
╭───┬───────────────╮
│ 0 │ ╭───┬───────╮ │
│   │ │ 0 │ Larry │ │
│   │ │ 1 │ Moe   │ │
│   │ ╰───┴───────╯ │
╰───┴───────────────╯

```

Find inverted values in records using regex
```nu
> [["Larry", "Moe"], ["Victor", "Marina"]] | find --regex "rr" --invert
╭───┬────────────────╮
│ 0 │ ╭───┬────────╮ │
│   │ │ 0 │ Victor │ │
│   │ │ 1 │ Marina │ │
│   │ ╰───┴────────╯ │
╰───┴────────────────╯

```

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

```

Find and highlight text in specific columns
```nu
> [[col1 col2 col3]; [moe larry curly] [larry curly moe]] | find moe --columns [col1]
╭───┬──────┬───────┬───────╮
│ # │ col1 │ col2  │ col3  │
├───┼──────┼───────┼───────┤
│ 0 │ moe  │ larry │ curly │
╰───┴──────┴───────┴───────╯

```

Chunks
accdc672 (1st chunk of `commands/docs/find.md`)
Title: find
Summary
The `find` command searches for specified terms within the input. It supports various flags for case-insensitive matching, regular expressions, inverting the match, specifying columns to search, and disabling highlighting. It can be used with lists, strings, and records, and the output type varies depending on the input type.