filtering signal strength output for script

Hi guys

I have been working on a script which checks all the wireless clients for bad signal strength and emails me a list of the bad signal clients…

When I check the signal strength of each client I get an output like “-83dBm@6Mbps” How do I filter the output to display just the digits? ie -83??

Here is my script:

:foreach i in=[ /int wir reg find ap=no] do={ :if ([int wir reg get $i signal-strength]<-73) do={
:log info (" SignalStrength: " . [int wir reg get $i signal-strength] . " SNR: " . [int wir reg get $i signal-to-noise] )
}}

If the script were to work then it will display the info into the log. But nothing happens when I run the script..

Any suggestions?

it’s easy

:global aaa "-83dBm@6Mbps"
:put [ :pick $aaa 0 [:find $aaa "dBm"]]

thanks mrz, how would I incorporate that into my script?

oh can it be adjusted for clients who have a signal strength less than -83? instead of exactly -83

:local signal;
:foreach i in=[ /int wir reg find ap=no] do={ 
  :set signal [int wir reg get $i signal-strength];
  :set signal [ :pick $signal 0 [:find $signal "dBm"]]
  :if ($signal < -73) do={
       :put "signal too low"
  }
}

something like that

Thanks it works..I changed it slightly but now it works great:

:local signal;
:foreach i in=[ /int wir reg find ap=no] do={
  :set signal [int wir reg get $i signal-strength];
  :set signal [ :pick $signal 0 [:find $signal "dBm"]]
  :if ($signal < -73) do={
       :log info (" SignalStrength: " . [int wir reg get $i signal-strength] . "  " . [int wir reg get $i comment] )
  }
}