Determine number of checklist in zenity dynamically...

Hi,
In my Shell Script i am counting the duplicate IPs in LAN,...After counting i have to show in checklist in zenity which one to delete from the LAN........so initially i dont know no. of duplicate IPs in the LAN....Hence i can determine how many check list needed.....

Duplicate IPs may range from 1 to 15......

It makes no sense to start a new thread for a reply within the same topic you started here: Dymically determing the number of check list in Zenity, How?. Ask a moderator to merge threads, then post the code you got sofar.

Hi Siva,

U can do somethng like this ..To get the IP's and their no.of occurances.

 TEST>cat ip_input.txt
192.121.121.212
12.212.21.211
211.211.22.112
211.211.22.112
211.211.23.111
TEST > sort ip_input.txt | sed '/^$/d' | uniq -c | sort -r -k 1
   2 211.211.22.112
   1 211.211.23.111
   1 192.121.121.212
   1 12.212.21.211
 

 
 
 
 

so based on maximum count's of IP u can do wht u wish to.

  I clearly show my problem by the following code.....

case "$n" in
1) ans=$(zenity --list --text "Tick to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" --separator=":") ;;
2) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" --separator=":") ;;
3) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" TRUE "$3" --separator=":") ;;
4) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" TRUE "$3" TRUE "$4" --separator=":") ;;
0) zenity --info --text "No Duplicate IP Restored....\!"
esac

----I want to avoid  case because checklist may go up to 15 or 20