Ip

De BlaxWiki
Aller à la navigationAller à la recherche

Ce script sert à éclater des ip une à une, dans le cas ou nous avons une liste d'ip comme ca :

10.252.5.161-10.252.5.174
10.252.5.181
10.252.5.192-10.252.5.197

Cela nous donnera :

10.252.5.161
10.252.5.162
.
.
.
10.252.5.174
10.252.5.192
10.252.5.193
.
.
10.252.5.197
10.252.5.181
  • Script
for i in `grep -- - ips.txt `; do a=`echo $i | cut -d '.' -f 4 | cut -d '-' -f 1`; b=`echo $i | cut -d '.' -f 7`; c=`echo $i | cut -d '.' -f 1-3`;for j in `seq $a $b`;
do echo $c.$j >> ips_detail.txt ;done;done; grep -v -- - ips.txt >> ips_detail.txt