Last update Wed Mar 30 15:48:21 2016

GREP: Search Files for Pattern

grep is used to search for strings in multiple files. Digital Mars grep is handy because it's fast, will search system and hidden files, will search for wide characters strings, and will search binary files.

Command syntax:

grep [switches] pattern { file }
the string to search for.
the name of the file to search. Multiple files can be listed, and wildcards can be used.
Suppress printing of filenames.
Become case-insensitive.
Recursively search subdirectories.
Verbose; print name of each subdirectory as it is searched.
Search for wide character strings.

grep will print each line in each file that contains a match for pattern. It works with binary files as well as text files.


To search all .c files for the string 'this':

grep this *.c

To find which library file is the one to link for FindFirstFile():

grep -i findfirstfile \dm\lib\*.*
Home | Runtime Library | IDDE Reference | STL | Search | Download | Forums