shell提取表名
1
#提取表名所在的行及接下來兩行。
2
find . -name *DaoImpl.java -exec grep getDbQualifier {} -A 2 \; >mine.txt
3
#提取表名,小寫轉大寫, 排序,去重
4
egrep -o "\.FMS\w+\s" mine.txt | tr 'a-z' 'A-Z' | sort | uniq > output.txt
5
#去掉行首點號
6
sed -i 's/^[.]//g' output.txt
7
#去掉行尾空白
8
sed -i 's/[ ]*$//g' output.txt
批量建目錄:
1
awk 'BEGIN{print "printing"}{system("mkdir "$1)}END{print "ending"}' us.txt