Loop through only the distinct values in a file

Datafile has the following data seperated by :
FIELD1:FIELD2:FIELD3
D1:/opt/9.1.9:Y
D2:/opt/10.1.10:Y
D3:/opt/9.1.9:Y
D4:/opt/8.1.8:Y
D5:/opt/8.1.8:Y
D6:/opt/9.1.9:Y
D7:/opt/9.1.9:Y
D8:/opt/10.1.10:Y
D9:/opt/9.1.9:Y
D10:/opt/10.1.10:Y

I want to do some operations only on the distinct values of FIELD2 in a loop.

To have an idea, check the following link

you have to be more specific here.. assuming this file is delimited by colons, u can get the distinct values by cut -f2 -d':' filename and pipe output to | sort | uniq

if u want it in loop the u can use
for i in `cut -f2 -d':' filenmae |sort|uniq`
do
ls -l $i #do something
done

its untested code so u may hv to tweak a little