Results 1 to 5 of 5
Hi All,
i am new to scripting
i have a file : file.dat with following data
Code:
STORAGE PERCENTAGE FLAG:
/storage_01 64% 0
/storage_02 17% 1
/storage_03 10% 0
/storage_04 ...
- 12-08-2010 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 5
Get min from a column
Hi All,
i am new to scripting
i have a file : file.dat with following data
I need to get the value of STORAGE from those with FLAG=0 and which has the min PERCENTAGECode:STORAGE PERCENTAGE FLAG: /storage_01 64% 0 /storage_02 17% 1 /storage_03 10% 0 /storage_04 50% 1

Please guide me on this..
Thanks in advance
- 12-08-2010 #2
- 12-08-2010 #3Just Joined!
- Join Date
- Dec 2010
- Posts
- 5
Hi Barriehie,
thank you so much..
Can you please explain me the code?
I am a newbie here....
thanks a lot
- 12-08-2010 #4Just Joined!
- Join Date
- Dec 2010
- Posts
- 5
and also can you let me know how can i get the STORAGE value deried from this in a variable?
- 12-08-2010 #5Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
The solution is also given in this forum:Code:storagename=$(awk ' NR==1{min=100;next} $3==0 && int($2)<min{min=int($2); s=$1} END{print s}' file)
Get min from a column conditionally - The UNIX and Linux Forums


Reply With Quote
