方便查询文件中的字符串
文件名:findstr
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 if [ $# -ne 2 ] 2 then 3 echo "info : invalid argument number [$#]" 4 echo "usage: $0 string file_filter" 5 exit -1 6 fi 7 8 find . -name "$2" -print|while read ff 9 do 10 nn=`grep "$1" $ff|wc -l` 11 if [ $nn -gt 0 ] 12 then 13 echo "==================== $ff =================" 14 grep "$1" $ff 15 echo "==========================================" 16 fi 17 done