options | illustrate |
---|---|
/l | Processes search strings literally. |
/r | Processes search strings as regular expressions. This is the default setting. |
/s | Searches the current directory and all subdirectories. |
/i | Ignores the case of the characters when searching for the string. |
/x | Prints lines that match exactly. |
/v | Prints only lines that do not contain a match. |
/n | Prints the line number of each line that matches. |
/m | Prints only the file name if a file contains a match. |
/o | Prints character offset before each matching line. |
some examples:
findstr /c:”hello world” hello.txt
—————————-search string “hello world” in hello.txt filefindstr /n /i /r /c:”<.*>” movie.html > result.out
—————————-find the pattern(regulation expression) in movie.html file and ouput the result to result.out file- findstr /n /i /s aba *.txt
——————————find string “aba” in all files in the current directory and its subdirectory