سؤال

BSD (Mac) grep allows for this command:

grep -n "FIXME" **/*.rb

But GNU grep forces me to specify at least a folder to start from:

grep -n "FIXME" {lib,spec}/**/*.rb

Is there a way to get this to behave like it does in BSD grep?

هل كانت مفيدة؟

المحلول

Switch to ack. It uses the recursive strategy by default, and comes with loads of tricky regexes for types of language files available as flags.

For instance, writing:

ack FIXME --ruby

Will search the current directory recursively for anything that may be a Ruby file. This will work the same on Mac and Linux.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top