text/plain doesn't tell you anything about the charset, so it doesn't have to be a ASCII file.
–
scaiJan 8 '13 at 7:17

so what the best solution ? how to verify if file is TEXT/ASCII ?
–
yaelJan 8 '13 at 7:20

you mean that I can get text/plain results even file is binary ?
–
yaelJan 8 '13 at 7:22

No, text/plain isn't returned for binary files of course. If you really want to know if the text uses ASCII encoding then just look at the charset as I already told you in your rather similar other question. But I suggest to learn first what ASCII actually means.
–
scaiJan 8 '13 at 7:43

@SCAI see Olivier Dulac solution - seems its the best verification for our quastin , what you think about ?
–
yaelJan 8 '13 at 8:53

seems this idea much more better then file command ( can we say this syntax is the best solution ? to verify TEXT/ASCII files )
–
yaelJan 8 '13 at 8:47

each tool has its use ^^ And it does use both "find" and "file" but each for their own best purpose (ie, find for finding files, and file for listing their type/purpose)
–
Olivier DulacJan 8 '13 at 8:58

OK so for the end I will use this syntax - find $PATH -type f -print | xargs file | awk '{print substr($0, index($0,$2))}' | egrep -ic "ascii|xml" ( in order to match ASCII or XML files
–
yaelJan 8 '13 at 9:40

@yael Are you sure you only want to match ASCII and no other charsets?
–
scaiJan 8 '13 at 10:13

you could maybe even drop the awk part altogether? file only outputs 1 line, and it should contain "ascii" and "xml" (and other times "text", "script", etc) so the grep would still catch it. maybe ` | egrep -ic '^[^:]*:.*ascii|^[^:]*:.*xml'` so that you don't match "xml" or "ascii" in the filename but in the "file" output ?
–
Olivier DulacJan 8 '13 at 10:16