I found myself typing find . -name "*.java" | xargs -iHn "something"  so often I decided to make it into a bash script and put it in a new ~/Dropbox/bin folder so that I never have to do it again. Worse I never use the print0 option which let's you search files that have spaces in the filename, as it's too hard to remember. So, here's the script.

#!/bin/bash
# A simple script to recursively search files
if [ "$#" -ne 3 ]; then
echo "efind (easy find) usage: [path] [file pattern] [regex]"
echo 'efind ../c "*.c" "string"'
exit 1
fi
find "$1" -name "$2" -type f -print0 | xargs -0 egrep -iHn "$3"
view raw efind hosted with ❤ by GitHub