is a shell command that searches for text in files and prints matching lines to standard output. The command provides similar functionality as <code>find</code>, but <code>findstr</code> supports regular expressions. However, <code>findstr</code> does not support UTF-16 whereas <code>find</code> does. <code>findstr</code> cannot search for null bytes commonly found in Unicode computer files.
<code>findstr</code> was first released as part of the Windows 2000 Resource Kit under the name <code>qgrep</code>. The command is available in Windows and ReactOS.
Use
The command syntax can be described as:
findstr FLAGS TEXT PATH...
TEXT: Text to search for.
PATH: Path to a file.
FLAGS:
<code>/B</code>: Match pattern if at the beginning of a line.
<code>/E</code>: Match pattern if at the end of a line.
<code>/L</code>: Use search strings literally.
<code>/R</code>: Use search strings as regular expressions.
<code>/S</code>: Search for matching files in the current directory and all subdirectories.
<code>/I</code>: Ignore case for matching.
<code>/X</code>: Print lines that match exactly.
<code>/V</code>: Print lines that do not match.
<code>/N</code>: Print the line number before each line that matches.
<code>/M</code>: Print only the file name if a file contains a match.
<code>/O</code>: Print character offset before each matching line.
<code>/P</code>: Skip files with non-printable characters.
<code>/OFF[LINE]</code>: Do not skip files with offline attribute set.
<code>/A:attr</code>: Specifies color attribute with two hex digits. See "color /?"
<code>/F:file</code>: Reads file list from the specified file (/ for console).
<code>/C:string</code>: Use specified string as a literal search string.
<code>/G:file</code>: Get search strings from the specified file (/ for console).
<code>/D:dir</code>: Search a semicolon delimited list of directories
: Print help information about the command.
Example
The following command searches the file named "services.txt" for lines containing "network" ignoring case.
See also
References
Further reading
External links