Windows: Grep-Like Command FINDSTR


Here is the way I execute grep-like command in Windows.

Windows doesn’t have grep command, so I used FINDSTR command.

FINDSTR

Windows has FINDSTR command.

Find text from file

When you search text in a file, put the file path after search keyword.

Find text from command output

When you search text in a output of a command, pass the output to FINDSTR with pipe.

Ignore large and small character difference

Like grep, /i option enables us to ignore large and small character difference.

Show line number

You can show line number with /N option.

Find text from files in a directory

You can search all files in a directory with * as follows.

This, *, is Windows’ normal wildcard. So you can specify extension as follows.

Search files in a directory recursively

When you search text recursively, use /S option.