Search in one or more files for text.
find [/v] [/c] [/n] [/i] [/offline] "
After searching the specified files,
any lines of text that contain the string you’ve
specified for your search.
find is useful for
searching for specific words (strings) in files, but
don’t get it confused with Start →
Search → For Files or Folders (See Windows Explorer in Chapter 4), which is capable of searching for text,
files, directories, etc., and has many other capabilities that the
find command doesn’t have.
find options are:
The text to look for, enclosed in quotation marks.
The file(s) in which to search. Although wildcards (*, ?) are not supported, multiple filenames can be specified as long as they are separated with commas. If
findsearches text typed at the prompt or piped from another command via the pipe character (
|), as described in Section 6.3, earlier this chapter.
Displays only the count of lines containing the string.
Ignores the case of characters when searching for the string.
Displays line numbers with the displayed lines.
Displays all lines not containing the specified string.
Includes files with the offline attribute set (that otherwise would be skipped).
Search for “redflag” in
find "redflag" myexployees.txt
Count occurrences of the word
find /c ...