findstr

Windows CMD · Text · available in the simulator

What it does

Searches for patterns and regular expressions in files.

Syntax

findstr [opciones] cadenas [archivo...]

Options and parameters

  • /B

    Matches the pattern if at the beginning of a line.

  • /E

    Matches the pattern if at the end of a line.

  • /L

    Uses search strings literally.

  • /R

    Uses search strings as regular expressions.

    findstr /r "error.*timeout" *.log
  • /S

    Searches for matching files in the current directory and all subdirectories.

    findstr /s /i "error" *.log
  • /I

    Ignores the case of characters when searching.

  • /X

    Prints lines that match exactly.

  • /V

    Prints only lines that do not contain a match.

  • /N

    Prints the line number before each line that matches.

  • /M

    Prints only the filename if a file contains a match.

  • /O

    Prints character offset before each matching line.

  • /P

    Skips files with non-printable characters.

  • /F

    Reads file list from the specified file.

  • /C

    Uses specified text as a literal search string.

    findstr /c:"error grave" log.txt
  • /G

    Gets search strings from the specified file.

  • /D

    Searches the specified list of directories.

Usage examples

  • findstr /i "error" *.log
  • findstr /s /n /i /r "error.*timeout" *.log
  • findstr /r "error.*timeout" *.log
  • findstr /s /i "error" *.log
  • findstr /c:"error grave" log.txt
Practise findstr

Related commands