shell 搜索文件夹下所有文件

 RETT=$(locate -r `pwd`'/core/[^ ]*\.h$' -r `pwd`'/core/[^ ]*\.hpp$');for i in $RETT;do cat $i | grep 'something_need_to_search'; if [ $? -ne 0 ] ; then echo $DD $i;fi;done;

locatemlocate.

-r表示以正则的方式进行匹配.

grep,找到退出码为0,没有则为1.

Guess you like

Origin blog.csdn.net/rubikchen/article/details/119916297