Whenever I use grep with gnuwin32's recurse option -r
and include a glob pattern for files to search (e.g. *.c
), no files in the subdirectories are searched. I am using the latest grep from gnuwin32.
Specifically, I was searching for the string "iflag" in all my c source files in a directory.
grep -r iflag *.c
Best Answer
Grep's
-r
option (which is the same as the-R
,--recursive
,-d recurse
and--directories=recurse
options) takes a directory name (or pattern) as its argument. The command you are trying to execute should be interpreted as "Starting in the current working directory recurse all directories matching the pattern *.c. In each of those directories search all files for the string iflag."