Hello,
I am trying to write a script to parse the output of data and then alert based on certain conditions
This is the output of my script
(STRING) Name = Joe
(FLOAT64) BMI = 34
(FLOAT64) Weight = 156
(STRING) Name = Sam
(FLOAT64) BMI = 32
(FLOAT64) Weight = 180
and so on it repeats in this order
I want to first display this in Column Wise, such that output is
Name BMI Weight
Joe 34 156
Sam 32 180
And then alert that record, where BMI > Weight
I have tried to use something like
script output | awk '{for(i = 1; i <= NF; ++i) { n = index($i, "="); if(n) { vars[substr($i, 1, n - 1)] = substr($i, n + 1) } } BMI = vars["BMI"] Var = vars["Weight"]} { if($BMI>$Weight print $Name $BMI $Weight}'
This doesnt work. Please assist.