How can I force grep to only return files and ignore directories?

bash, grep, locate, unix

Solution

The `find` command?

find /bin -name bibtex -type f

Looks for a file name "bibtex" of type "f", which is a regular file.

Problem

I'm trying to use grep to automatically locate the bibtex program in the user's bin folder. The problem is, it frequently returns a directory with the name bibtex, which means that the script fails to automatically run the command. How can I force grep (or indeed the locate command) to automatically ignore directories? EDIT: The current command is: `locate bibtex | grep "/bibtex$" -d skip | head -n1`

Original source