共计 305 个字符,预计需要花费 1 分钟才能阅读完成。
#!/bin/bash
> final.txt
echo “ 姓名, 手机,QQ, 专业 ” >> final.txt
echo “ 开始生成信息 …..”
sinfofile=`ls *.txt`
for file in ${sinfofile}
do
name=$(grep “ 姓名 ” $file | cut -d: -f
2)
phone=$(grep “ 手机 ” $file | cut -d: -f
2)
qq=$(grep “QQ” $file | cut -d: -f
2)
major=$(grep “ 专业 ” $file | cut -d: -f
2)
echo “$name,$phone,$qq,$major”
>> final.txt
done
echo “ 信息生成完毕!!”
exit 0