mirror of
https://github.com/gaoyifan/china-operator-ip.git
synced 2025-07-14 05:12:28 +08:00
Refactoring stat.sh
This commit is contained in:
parent
c74585c9f5
commit
eeae995e4e
45
stat.sh
45
stat.sh
@ -2,34 +2,25 @@
|
|||||||
|
|
||||||
source common.sh
|
source common.sh
|
||||||
cd result
|
cd result
|
||||||
for file in *.txt; do
|
for file in *.txt; do
|
||||||
echo ${file%.*}
|
echo ${file%.*}
|
||||||
if [[ $file == *6.txt ]]; then
|
if [[ $file == *6.txt ]]; then
|
||||||
cat $file |
|
#statistics IPv6 /48 blocks
|
||||||
awk -F\/ '{print $2}' |
|
base=48
|
||||||
(
|
else
|
||||||
sum=0
|
base=32
|
||||||
while read n; do
|
fi
|
||||||
if [[ -n $n ]]; then
|
cat $file |
|
||||||
((s=64-n))
|
awk -F\/ '{print $2}' |
|
||||||
((sum+=1<<s))
|
(
|
||||||
fi
|
sum=0
|
||||||
done
|
while read n; do
|
||||||
echo $sum
|
if [[ -n $n ]] && [[ $n -le $base ]]; then
|
||||||
)
|
((s=base-n))
|
||||||
else
|
((sum+=1<<s))
|
||||||
cat $file |
|
fi
|
||||||
awk -F\/ '{print $2}' |
|
done
|
||||||
(
|
echo $sum
|
||||||
sum=0
|
)
|
||||||
while read n; do
|
|
||||||
if [[ -n $n ]]; then
|
|
||||||
((s=32-n))
|
|
||||||
((sum+=1<<s))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo $sum
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
echo
|
echo
|
||||||
done | tee stat
|
done | tee stat
|
||||||
|
Loading…
Reference in New Issue
Block a user