Não sei se entendi o problema corretamente ...
#!/bin/bash
segsize=100
segL=0
max=0
a=()
while read p; do
(( n = (p - segL - 1) / segsize ))
if (( n + 1 > max )); then
for ((i = max; i < n + 1; i++)) do
a+=(0)
done
(( max = n + 1 ))
fi
(( a[n]++ ))
done
for ((i = 0; i < max; i++)); do
echo "segment $((i+1)) ($((segsize*i)), $((segsize*(i+1)))] : ${a[$i]}"
done
Entrada (cada número deve ser > 0):
1
100
101
200
1000
1001
Saída:
segment 1 (0, 100] : 2
segment 2 (100, 200] : 2
segment 3 (200, 300] : 0
segment 4 (300, 400] : 0
segment 5 (400, 500] : 0
segment 6 (500, 600] : 0
segment 7 (600, 700] : 0
segment 8 (700, 800] : 0
segment 9 (800, 900] : 0
segment 10 (900, 1000] : 1
segment 11 (1000, 1100] : 1