Use grep to remove empty lines instead of the -r flag to xargs.

xargs on Mac OS X doesn't support -r, it's a GNU extension.