一般用来统计某个方法在项目代码里的引用情况
#!/bin/bash
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
# 匹配 '\apps\'
awk -v thisfile="$dir_or_file" '{if($0 ~ "\\\\apps\\\\"){print thisfile, NR, $0}}' $dir_or_file
fi
done
}
root_dir="/Users/mfw/Documents/work/pay"
getdir $root_dir