Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Comparing multiple variables containing numbers


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Comparing multiple variables containing numbers

Code:
a=1 456
b=4928
c=23
d=456

I want to compare four variables to get the name of the variable having the highest number

Last edited by proactiveaditya; 3 Weeks Ago at 09:07 AM..
# 2  
Any attempts / ideas / thoughts from your side?
# 3  
Try below: May be better solution will be there

Code:
$ val=`awk -F = '{print $2}' file | sort -nr | head -1`
$ echo $val
4928
$ grep $val file| awk -F '=' '{print $1}'
b

Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Where to being Comparing numbers?
Ccccc
Hi. I do not know how to compare numbers and need help. In my script I have to figure the MAX, MIN, & Avg. Sales amounts. Please help me. In the code, "transaction" is a counter. #!/bin/bash clear transaction=0 sales=0 total=0 while test $sales ...... Shell Programming and Scripting
9
Shell Programming and Scripting
comparing multiple variables by 'if then'
smallville
Hi, I am a noob at shell scripting. basically I am trying to compare row counts from 8 tables in different databases. I have managed to get the row counts using awk from the spool files for both databases. now I have 16 variables with me for database 1 : $A $B $C $D $E $F $G...... Shell Programming and Scripting
3
Shell Programming and Scripting
Comparing multiple variables
Bugenhagen
Hi! I've come up with a ksh-script that produces one or more lists of hosts. At the and of the script, I would like to print only those hosts that exists in all the lists. Ex. HOSTS="host1 host2 host3 host11" HOSTS="host1 host2 host4" HOSTS="host2 host11" HOSTS="host2 host5 host6 host7...... Shell Programming and Scripting
1
Shell Programming and Scripting
comparing with numbers.
nagendramv
How to compare a variable with a value like 00:00:10 ? Thanks... Shell Programming and Scripting
4
Shell Programming and Scripting
Comparing two numbers
TabloMaxos
Hello, I kinda newbie in unix so I would like so help.I know that there is a command that compares two integer numbers test (eg. #$1=0 ).I would like to know if it is possible to compare any number with another (eg. 2.3=0 or 3.7!=0 4.5>2.2). Thank you in advance.... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers

Featured Tech Videos