Search string (linux / windows) all the files in the folder

In linux you can use 

grep "String" filename.txt
# filename string
grep -r "String" / Home /
# recursive search for all files in a directory
to find the next single file or directory contains all the files in a string

The windows can also achieve similar functionality

findstr can do this.

findstr / s / i "string" *. *
The above command said that the current all files in a directory and all subdirectories in the current directory lookup "string" This string.

*. * Means all types of files.

/ S indicates the current directory and all subdirectories

/ I represents a case insensitive

It can be explained with reference to help findstr output to use this command.

 

note:

findstr.exe usually C: \ \ under the Windows System32 directory, invoke the command from any path, you need to C: \ Windows \ System32 added to the path environment variable, if not add environment variables can be so used

C:\Windows\System32\findstr.exe /s /i "string" *.*

Guess you like

Origin www.cnblogs.com/bensonyang/p/12010205.html