BW test with send message on x<50Mbps

I am trying to think how to write a script that would be something along:
too bandwidth-test direction=receive protocol=tcp user=bwtest password=bwtestpw address=192.168.82.2 duration=3
then grab the number from:
rx-total-average: 71.1Mbps
and compare to 50
resulting in send message if below.

I am unsure of the grab and compare part

any script suggestions?

I have a AF-5x link that seems to fall apart occasionally (or is be attacked!!!) so I have a Mikrotik on either side that can watch for me if I am smart enough!!

:local IP “192.192.18.2”
:local USER “admin”
:local PASS “58865”
:local txc
:local txcA
:local txcB
:local txcC
:local txta
:local txtaA
:local txtaB
:local txtaC

/tool bandwidth-test $IP protocol=tcp direction=transmit duration=3s user=$USER password=$PASS do={

:set txcA ($“tx-current” / 1000)
:set txcB ($txcA / 1000 * 1000)
:set txcC ($txcA - $txcB)
:set txcB ($txcB / 1000)
:set txc “$txcB.$txcC”

:set txtaA ($“tx-total-average” / 1000)
:set txtaB ($txtaA / 1000 * 1000)
:set txtaC ($txtaA - $txtaB)
:set txtaB ($txtaB / 1000)
:set txta “$txtaB.$txtaC”
}

/tool e-mail send to=“tknlgs@gmail.com” subject=“Bandwidth-test done : $sysname” body=“$sysname \n $datetime \n \n Result : \n TX speed $txc Mbps/s \n RX speed $rxc Mbps/s \n \n TX total average $txta Mbps/s \n RX total average $rxta Mbps/s”