Demand:
IDC briefing room a bunch of expired domain name client interface off the record, and I need to judge here in these domains there is a client side has been suspended resolved, is there to resolve those records, and then inform the customer to suspend the domain name resolution
First sort remove duplicate domain name:
cat 2.txt |sort -rn|uniq -c|awk '{print $2}' >b.txt
Find b.txt this file still has to resolve those records:
for n in `cat /root/b.txt`;do echo $n& ping -c1 -i 0.1 $n -q|grep 'PING'|grep -v '127.0.0.1';done;
Output during execution of the content as follows:
[1] 38765
m.z3o8i.cn
[1]+ Done echo $n
[1] 38769
m.z1w4ri.cn
[1]+ Done echo $n
[1] 38773
m.yunranfa.cn
PING s.cooolyi.cn (221.195.1.103) 56(84) bytes of data.
[1]+ Done echo $n
[1] 38835
m.yunnvjie.cn
PING s.cooolyi.cn (183.60.136.216) 56(84) bytes of data.
[1]+ Done echo $n
[1] 38839
m.yqbyiw86.cn
PING s.cooolyi.cn (183.60.136.216) 56(84) bytes of data.
[1]+ Done echo $n
The contents of the above documents appended to the output file 11.txt
filtered well resolved, the two domain names beginning with m:
sed -e '/Done/{d}' -e '/\[1\]/{d}' 11.txt|grep -B 1 'PING'|grep "^m"
There was filtered off parsing, .cn end to end of two and .com domain names:
[root@localhost ~]# sed -e '/Done/{d}' -e '/\[1\]/{d}' 11.txt|grep -B 1 'PING'|grep ".cn$"|head -2
m.yunranfa.cn
m.yunnvjie.cn
[root@localhost ~]# sed -e '/Done/{d}' -e '/\[1\]/{d}' 11.txt|grep -B 1 'PING'|grep ".com$"|head -2
m.vhu5j1.com
m.qeiuke.com