grep on windows code example
Example 1: how to make history | grep in windows
Use doskey in Windows for requesting your command history. For that you first
have to create once a storage file in some directory as follows:
doskey /history > C:/history.txt
Then just use doskey command together with fidstr to filter your history:
doskey /history | findstr "substring"
Example 2: grep in windows
Use findstr in Windows with following command line structure:
findstr [/I] [/S] "substring" "regex_file_name"
/I Case-insensitive search.
/S Search files in subfolders recursively.
Example 3: grep windows
findstr /spin /c:"string" [files]
The parameters have the following meanings:
s = recursive
p = skip non-printable characters
i = case insensitive
n = print line numbers
And the string to search for is the bit you put in quotes after /c: