Skip to content
Back to top

# mutool grep

The `grep` command searches for text in a document and prints each matching line.

    mutool grep [options] pattern file [ file2 ...]

`pattern`

`file`

  Document to search in.

`[options]`

> Basic options:

> `-p` password

>   Use the specified password if the file is encrypted.

> `-G`

>   The pattern is a regular expression.

> `-a`

>   Ignore diacritics and accents (treat ä and a as the same).

> `-i`

>   Ignore case (treat A and a as the same).

> `-H`

>   Print filename for each match.

> `-n`

>   Print page number for each patch.

> Avanced options:

> `-S`

>   See /reference/common/search-options.

> `-O`

>   See Structured Text Options.

> `-b`

>   Search backwards, starting from the end.

> `-[` start-mark

>   Insert mark at the start of each match when printing results.

> `-]` end-mark

>   Insert mark at the end of each match when printing results.

> `-v`

>   Show verbose search debugging feedback.

> `-q`

>   Hide all warnings and error messages. Use at your own risk!