Issue
find . -type f | xargs file | grep text | cut -d':' -f1 | xargs grep -l "TEXTSEARCH" {}
it's a good solution? for find TEXTSEARCH recursively in only textual files
Solution
You can use the -r
(recursive) and -I
(ignore binary) options in grep
:
$ grep -rI "TEXTSEARCH" .
-I
Process a binary file as if it did not contain matching data; this is equivalent to the--binary-files=without-match
option.-r
Read all files under each directory, recursively; this is equivalent to the-d recurse
option.
Answered By - kev Answer Checked By - David Marino (WPSolving Volunteer)