Parse output and then compare column wise with awk

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.

My advice would be not to edit the script's output but to get it right within the script. Pls. post the script for discussion.

The script connects to an API and gets the data. The data is returned in the output I provided.

Unfortunately, due to syntax, semantic, and logic error plus sloppy typing, the code you provided will never run nor produce any output.
Try instead

awk  -F= '
                {ARR[NR%3] = $2
                }

NR == 1         {print "Name","BMI","Weight"
                 next
                }

!(NR % 3)       {if (ARR[2] > ARR[0]) print ARR[1], ARR[2], ARR[0]
                 split ("", ARR)
                }
' OFS="\t" file

making some assumptions....

weight=32
script output | paste - - - | awk -v w=${weight}  '$8 > w { print $4, $8, $12}'