shell脚本:检出文所有包含某字符串的文件中所include的头文件

1 #!/bin/bash
2 for i in `grep CPU_ZERO ./ -nrw | awk -F: '{print $1}'`
3 do
4     echo $i
5     head -20 $i | grep "#include"
6     echo " "
7 
8 done

如果还想统计头文件出现的次数,则:

./inc.sh | grep "<sched.h>" | wc -w
原文地址:https://www.cnblogs.com/xxg1992/p/7388112.html