Get the App
SLTechnology News&Howtos  ›  Servers  › 

The shell script determines whether the domain name has a resolution record.

Shulou Source: shulou.com Published: 2022-06-03 09:55:32 09月21日 Update

The shell script implements to find out which domain names still have resolution records from a pile of domain names in

Record generation requirements: find out which domain names still have resolution records from the pile of domain names provided by the IDC computer room

Sort first to remove duplicate domain names:

Cat 2.txt | sort-rn | uniq-c | awk'{print $2}'> test

Execute script sh 2.sh m or sh 2.sh e or sh 2.sh unknown corresponding generation file m.log e.log wujilu.log

[root@intf-06 ~] # cat 2.sh #! / bin/shlist=$ (cat / root/test) for n in $listdo echo $n | tee-a 1.log & ping-C1-I 0.1$ n-Q 2 > & 1 | tee-a 1.logdone if [$1 = = "m"]; thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep-B 1' PING' | grep "^ $1" > m.logecho "> 1.log elif [$1 =" e "] Thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep-B1' PING' | grep "^ $1" > e.logecho "> 1.log elif [$1 =" unknown "]; thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep" $1 "| awk-F' [:] +'{print $2}'> wujilu.logecho" > 1.logfi

The obtained results are as follows:

Secondary domain name [root@intf-06 ~] # cat m.log m.qxwfc.cnm.qldua.cnm.wstzk.cnm.gsnon.cnm.fzhxzm.cnm.ew740.cn with resolution record beginning with m [root@intf-06 ~] # cat e.log e.gsnon.cne.fzhxzm.cne.ew740.cn with resolution record [root@intf-06 ~] # cat wujilu.log m.0v43q.cne.x51se.cn without resolution record

Tags: Domain name second-level domain name script beginning generation file computer room results requirements sorting Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Xiaomi Apple MariaDB