#! /bin/bash
#!/bin/bash
function read_dir(){
for file in ` ls $1 `
do
if [ -d $1"/"$file ]
then
read_dir $1"/"$file
else
fileName=$1"/"$file
findWord $fileName
fi
done
}
function findWord(){
num=1
cat $1 | while read line
do
targe=`echo $line | grep -P 'i18n([.](\d|[a-z]|[A-Z]|_)+){2,}' -o`
if [ "$targe" != "" ]; then
echo $targe',"'$1"--"$num'"'
fi
num=$((num+1))
done
}
#测试目录 test
INIT_PATH="src"
read_dir $INIT_PATH
shell脚本文件扫描-使用shell脚本读取当前目录下所有文件的包含字符串
于 2018-09-21 00:39:23 首次发布