Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grep recursive with wild card not working

Tags:

linux

grep

$ grep -r 9900 *.mk
grep: *.mk: No such file or directory
$ grep -R 9900 *.mk
grep: *.mk: No such file or directory

$ grep -V
GNU grep 2.5.4

am I using a wrong grep? or what is the syntax? Thanks!

like image 629
rodee Avatar asked Oct 20 '25 04:10

rodee


1 Answers

You can use the include flag:

grep -r --include="*.mk" 9900 .

grep manual page says:

--include : If specified, only files matching the given filename pattern are searched.

like image 65
Faruk Sahin Avatar answered Oct 22 '25 03:10

Faruk Sahin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!