|
发表于 2009-10-29 10:38:20
|
显示全部楼层
- #!/bin/bash
- FILE=cardno.txt
- TMPFILE=card-tmp.txt
- TMPFILE1=card-1.txt
- TMPFILE2=card-2.txt
- sed -n -e "/23/p" $FILE > $TMPFILE1
- sed -n -e "/7/p" $FILE > $TMPFILE2
- # merge and
- sort -m $TMPFILE1 $TMPFILE2 | uniq > $TMPFILE
- rm $TMPFILE1 $TMPFILE2
- # this is output, you can redirect to other file
- cat $TMPFILE | grep -e "\(3\|7\)\>" > A.txt
- rm $TMPFILE
复制代码 |
|