'for' loop advice needed....!!

Scenario:

Command used to capture IPs on a host:

/usr/sbin/ifconfig -a | grep "inet" | egrep -v "inet6|0.0.0.0|192.168.100.2" | awk '{print $2}'

Following for loop used to capture interface names:

for INTERFACE in `/usr/sbin/ifconfig -a | nawk '$1 ~ /:$/ && $1 {sub(":$", "", $1); print $1}'`
        do
        val=`/usr/sbin/ifconfig $INTERFACE | grep -w "@@Host IPs.IP Addresses@@"|awk '{print $2}'`
        if [ $val = "@@Host IPs.IP Addresses@@" ]
        then
            echo $INTERFACE
        fi    
done

@@Host IPs.IP Addresses@@ comes from the above command used to capture IPs.

Iteration is taken care by my engine.

Issue:

I have a solaris host where 'ifconfig -a' shows 7 loopback interfaces with same IP.

Take a look at following

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000
lo0:2: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000
lo0:4: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000
lo0:6: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000
lo0:7: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000
lo0:8: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone <ZONE>
        inet 127.0.0.1 netmask ff000000

As you can see,these interfaces have same IP and this is where the 'for' loop is fumbling.

Look at the o/p i am getting:

<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0lo0:1lo0:2lo0:4lo0:6lo0:7lo0:8       N/A  

This is what i want :

<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:1		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:2		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:4		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:6		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:7		N/A  
<HOST> 127.0.0.1       255.0.0.0       <DNS>      2010-03-16      lo0:8		N/A  

Can anyone suggest a better way ?

Regards
Abhi

Any idea/suggestion/advice pls ...!!

Regards
Abhi

What is it you're trying to gather? a zone to loopback interface mapping?

maybe this..?

for zone in `zoneadm -i|grep -v global`
do
echo "*****************"
zlogin $zone ifconfig -a|grep lo|awk -F: '{print $1":"$2}'
done


thanks erice !!

i am trying to capture all the IPs and respective interfaces on a host...both are two columns of a csv file....

Regards
Abhi