count the number of IP

This commit is contained in:
Yifan Gao 2017-01-24 01:52:37 +06:00
parent 768cdf6da2
commit 7ff126697e

View File

@ -41,3 +41,21 @@ while read file; do
get_asn $file | xargs bgptools | docker run -i --rm gaoyifan/cidrmerge > result/$operator.txt
>&2 echo "done"
done
# count the number of IP
cd result
ls |
while read file; do
echo ${file%.*}
cat $file |
awk -F\/ '{print $2}' |
(
sum=0
while read n; do
s=$((32 - ${n}))
sum=$(($sum + 1<<$s))
done
echo $sum
)
echo
done > stat