find . -type f -exec grep -I -q . {} \; -print This will find all regular files (-type f) in the current directory (or below) that grep thinks are non-empty and non-binary.
It uses grep -I to distinguish between binary and non-binary files. The -I flag and will cause grep to exit with a non-zero exit status when it detects that a file is binary. A "binary" file is, according to grep, a file that contains character outside the printable ASCII range1.
The -q option to grep will cause it to quitequit with a zero exit status if the given pattern is found, without emitting any data. The pattern that we use is a single dot, which will match any character.
If the file is found to be non-binary and if it contains at least one character, the name of the file is printed.
If you feel brave, you can plug your flip -u into it as well:
find . -type f -exec grep -I -q . {} \; -print -exec flip -u {} \; 1 Fun fact: Technically, a binary file on Unix is any file that doesn't end with a newline character.