In Windows, if I wanted to find a string across all files in all subdirectories, I would do something like
findstr /C:"the string" /S *.h
However, in Linux (say, Ubuntu) I have found no other way than some piped command involving find
, xargs
, and grep
(an example is at this page: How can I recursively grep through sub-directories?). However, my question is different: is there any single, built-in command that works through this magic, without having to write my shell script?
*
to'*'
: "Quoting the last wildcard is needed to avoid errors when some filename starts with -" – Michael Mrozek Feb 14 '11 at 16:07-Msomething
, or to aGREP_OPTIONS
setting. – Gilles 'SO- stop being evil' Feb 14 '11 at 20:43