1

I tried using this:

      $ find . -type f -exec file {} \;
        ./alma: ASCII text
        ./jaj.C: C source, ASCII text
        ./repa: ASCII text, with escape sequences
        ./mas.cpp: C++ source, ASCII text
        ./capa: ASCII text
        ./valami: ASCII text

But if it's a cpp file for example it still writes text so I can't use grep to exclude binary files....what should I do?

Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115
Reggie Kapros
  • 101
  • 1
  • 8

1 Answers1

3

Here's the fast method to do it:

find . -type f -exec grep -Iq . {} \; -print

-I in grep will ignore binary files, text files will match right away because of . (any character match), grep will give success for matched file, so -print from find will print the filename.

Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115