shell提取表名

边查书边试验,

#提取表名所在的行及接下来两行。
find . -name *DaoImpl.java -exec grep getDbQualifier {} -A 2 \; >mine.txt
#提取表名,小写转大写, 排序,去重
egrep -o "\.FMS\w+\s" mine.txt | tr 'a-z' 'A-Z' | sort | uniq > output.txt
#去掉行首点号
sed -i 's/^[.]//g' output.txt
#去掉行尾空白
sed -i 's/[ ]*$//g' output.txt

批量建目录:

awk 'BEGIN{print "printing"}{system("mkdir "$1)}END{print "ending"}' us.txt



你可能感兴趣的:(shell)