News for hackers. Stuff that matters.
Re:ffind: a sane replacement for command line file search by mwfunk on Sunday June 09, 2013 @04:03PM (#5850304)
I find myself doing this a lot when sifting through huge codebases:

find . -type f -print0 | xargs -0 grep -Hin <identifier>

The -print0/xargs thing is to get around spaces in filenames or directories. I don't think spaces belong in source files (or directory trees containing source code) for a gazillion different reasons, but I still stumble across it every once in a great while. There are also platforms where system directories have spaces in them, so if you're scrounging through a deep subdirectory tree trying to find something, you may have to deal with the spaces thing. I've been bitten by it enough times that I just always do this rather than have to think about whether or not I might need to do it every time I use find.

Depending on what I'm looking for, I might select files with -type, or a -name glob, or whatever. I use '-type f' most commonly because the source code I deal with has a fair number of interesting things defined outside of files with the standard source/header extensions in their names.

There's usually a couple pipe stages after this filled with 'grep -v <stuff I don't care about>', or more greps to narrow down the result set. Sometimes this all goes in shell scripts or sometimes I just type it all out.

Re:ffind: a sane replacement for command line file search by psutor on Sunday June 09, 2013 @05:00PM (#5850581)
How about

  grep -irn <identifier> .
?

-r recurses and since it is multiple files implies -H.

Re:ffind: a sane replacement for command line file search by mwfunk on Monday June 10, 2013 @06:08PM (#5857674)
Yep, that's much nicer. :) I always forget about recursive grep.