应用案例:
有两个文件,qq1_id.txt和qq_id2.txt,现要将两个文件里相同的qq号码找出来,并导入新文件qq_id.txt中(获取两个文件里相同的号码或字符)
#!/bin/bash
CAT1=`cat /root/qq_id1.txt`
CAT2=`cat /root/qq_id2.txt`
for TM in $CAT1
do
for SM in $CAT2
do
if [ $TM = $SM ] ; then
`echo "$SM" >> /etc/qq_id.txt`
fi
done
done
阅读(1468) | 评论(0) | 转发(0) |