Linux command: How to 'find' only text files?

前端 未结 16 886
孤街浪徒
孤街浪徒 2020-12-02 04:43

After a few searches from Google, what I come up with is:

find my_folder -type f -exec grep -l \"needle text\" {} \\; -exec file {} \\; | grep text
         


        
16条回答
  •  春和景丽
    2020-12-02 05:18

    • bash example to serach text "eth0" in /etc in all text/ascii files

    grep eth0 $(find /etc/ -type f -exec file {} \; | egrep -i "text|ascii" | cut -d ':' -f1)

提交回复
热议问题