I'm looking for a particular string (mainly in .c files) recursively from the root directory.
When I use this, I get a list back almost immediately.
grep -rl "F_capture" .
However, if I try to speed things up by just searching .c files:
grep -r --include=*.c "F_capture" .
I end up with a slew of recursive directory warnings like this:
grep: warning: ./sys/block/fd0/device/bus/drivers/i8042/i8042/serio1/input:event1/subsystem/event3/device/bus/drivers/pcnet32/0000:00:03.0/subsystem: recursive directory loop
When I tried suppressing the warnings using the -s parameter, I don't get the warnings but I don't get anything back either - seems like it's going off into never never land.
grep -rsl --include="*.c" "F_capture" .
So I guess my question is, why does the first grep I used return something immediately and the other types where I'm targeting a specific type of file seem to hang up. I would think the targeted search would be faster.
You can try this:
find . -type f -name "*.c" -print|xargs grep -l "F_capture"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With