In a Bash script, I would like to split a IP by dot delimiter. But When I am passing a variable in For Loop it is behaving like string.
StartIP=10.10.140.10
EndIP=10.10.140.15
StartIP_Prefix_1=`echo $StartIP | awk -F"\." '{print $1}'`
StartIP_Prefix_2=`echo $StartIP | awk -F"\." '{print $2}'`
StartIP_Prefix_3=`echo $StartIP | awk -F"\." '{print $3}'`
StartIP_Prefix_4=`echo $StartIP | awk -F"\." '{print $4}'`
EndIP_Prefix_3=`echo $EndIP | awk -F"\." '{print $3}'`
EndIP_Prefix_4=`echo $EndIP | awk -F"\." '{print $4}'`
IP_Prefix=$StartIP_Prefix_1.$StartIP_Prefix_2
IP_Range=$IP_Prefix.{$StartIP_Prefix_3..$EndIP_Prefix_3}.
{$StartIP_Prefix_4..$EndIP_Prefix_4}
for ip in $IP_Range
do
echo $ip
done
After running the script, It is showing 10.10.{40..40}.{10..15}
expect : I want it show all the IPs like: 10.10.140.10 10.10.140.11 10.10.140.12 10.10.140.13 10.10.140.14 10.10.140.15
Please, Let me know if there any other option to find out IPs between two IPs.