I am using grep from Gnuwin32 on Windows.
Doing:
grep -r INSERT *.sql
Yields:
grep: *.sql: Invalid argument
Any idea why?
Answer
According to the Grep manual:
-r
with grep is recursive directory searching, so to use it you specify the starting directory, not a file mask.
e.g.:
grep -r INSERT .
would look at all files for INSERT, starting at the current directory (.
) and recursively working its way through the sub-folders.
To specify recursive folder checking and specify a file wildcard to limit searches, you can use the --include
option:
grep -r --include "*.sql" INSERT .
Similar question/info over on StackOverflow: How do I grep recursively?
No comments:
Post a Comment