I have cygwin installed and when I search for the source code with this command nothing show up, even that I have that string in a file
$ echo foo > bar
$ find . -name '*' | grep foo
Nothing shows up. This command works fine on GNU+Linux.
$ grep foo bar
Best Answer
As mentioned, find outputs a list of found files to stdout, grep normally expects to search through stdout if called this way.
Could also pipe find to
xargs
, and it will "build and execute command lines from standard input", as inIf you have crazy filenames, with newlines and whatnot, then this would be better:
and the
-type f
will only find regular files, so no attempts to grep through any.
or..
or any directories or "funny" files.