china-operator-ip/stat.sh
Zhaofeng Yang (楊肇峰) c74585c9f5 add ipv6 list (#12)
* change asname source

* change rib source

* generate for ipv6

* fix typo

* update travis data

* change docker image

* delete duplicate lines before merge cidr

* change rib source

* change style of upstream

* modify arg for uniq

* change some conf files to symlink

* update stat

* add sudo for apt in travis config

* add stat for 0

* fix bug for stat

* set -x

* curl -vv

* change dist to bionic

* remove verbose options
2019-12-19 14:39:16 +08:00

36 lines
485 B
Bash
Executable File

#!/usr/bin/env bash
source common.sh
cd result
for file in *.txt; do
echo ${file%.*}
if [[ $file == *6.txt ]]; then
cat $file |
awk -F\/ '{print $2}' |
(
sum=0
while read n; do
if [[ -n $n ]]; then
((s=64-n))
((sum+=1<<s))
fi
done
echo $sum
)
else
cat $file |
awk -F\/ '{print $2}' |
(
sum=0
while read n; do
if [[ -n $n ]]; then
((s=32-n))
((sum+=1<<s))
fi
done
echo $sum
)
fi
echo
done | tee stat