Determine number of checklist in zenity dynamically...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Determine number of checklist in zenity dynamically...
# 1  
Old 04-30-2009
CPU & Memory 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......
# 2  
Old 04-30-2009
It makes no sense to start a new thread for a reply within the same topic you started here: https://www.unix.com/shell-programmin...enity-how.html. Ask a moderator to merge threads, then post the code you got sofar.
# 3  
Old 04-30-2009
Hi Siva,

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

Code:
 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.
# 4  
Old 04-30-2009
CPU & Memory Dymically determing the number of check list in Zenity, How?

Quote:
Originally Posted by panyam
Hi Siva,

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

Code:
 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How do I determine the best number to use for the bs (block size) operand of the dd command?

When I create a bootable Linux distro installation USB drive, I use this command: sudo dd if=/Path/to/linux_distro.iso of=/dev/rdisk<disk number> bs=<number of bytes> When I look it up, I've seen variations of people choosing 4M, and I think 8M, 2M, and maybe even 1M. If I leave the operand... (4 Replies)
Discussion started by: Quenz
4 Replies

2. Shell Programming and Scripting

Reading from a dynamically decided line number

Hi All, We get a file from our client for processing everyday. We have to start reading the file from the line after the line that says "version=". My idea was to grep and find the line number(say 'n') of the line with "version=" and start reading from the (n+1)th line. Can anyone please guide... (7 Replies)
Discussion started by: jerome_rajan
7 Replies

3. Shell Programming and Scripting

Determine the frequency of each number within a text file

I'd like to determine the frequency that each number occurs within a text file. I know how to do this for a single number, but not for a set or list of numbers. Here's what I have grep -o 01 file.txt | wc -l Also, it's important that the numbers are two digits instead of 1, meaning that... (8 Replies)
Discussion started by: it5ju5talx
8 Replies

4. Shell Programming and Scripting

determine the number of spaces

Here is a weird question :) i am trying to create a script written in bash that will create configuration files for nagios. As some of you aware is has to be written in the below format: define service{ option1 value1 option2 value2... (6 Replies)
Discussion started by: ppolianidis
6 Replies

5. UNIX for Advanced & Expert Users

How to determine the number of NFS threads RUNNING on the system

Hi, Anyone can tell me how to get the number of NFS threads RUNNING on the system for Solaris 10? Someone told me for Solaris 9, the method is "echo "*svc$<svcpool" | adb -k. But, I've tried to google the method for Solaris 10 and did not find the corresponding method, please help... (1 Reply)
Discussion started by: wang.caiqi
1 Replies

6. Shell Programming and Scripting

Dymically determing the number of check list in Zenity, How?

hi, In my project i cannot determine the number of check list initially... I will know dynamically during execution... so How to specify the number of check list dynamically in zenity Waiting for your precious Answer..... (1 Reply)
Discussion started by: shivarajM
1 Replies

7. Shell Programming and Scripting

Using 'stat' to determine file system type (with Zenity)

edited and removed (0 Replies)
Discussion started by: mdpalow
0 Replies

8. Shell Programming and Scripting

Determine Number of Processes Running

I am pretty new to unix, and I have a project to do. Part of the project asks me to determine the number of processes running and assign it to a variable. I know how to every part of the project but determine the number of processes running. How can I get just the number of processes... (4 Replies)
Discussion started by: wayne1411
4 Replies

9. Shell Programming and Scripting

$A is a number / any other string? How to determine ?

I have a variable (say $A) and while passing it gets either a number or some other string. Now how can test (with if else) whether the variable is just a ne or something else ? Thanks a lot to all in advance C Saha (2 Replies)
Discussion started by: csaha
2 Replies

10. HP-UX

determine number of xterm connected

i more than one hp-ux 11.0 application server. some of these application server has an xterminal attached to them. ncd900 and ncd400. i would like to know how many xterm is connected to an application server. without physically checking each xterm, can i identify how many xterm? thanks alot. (0 Replies)
Discussion started by: inquirer
0 Replies
Login or Register to Ask a Question