title: Parsing iw wlan0 station dump output
body: <p>I know this is a similar question from other posts. But i would like to <strong>parse iw wlan station dump</strong> and save the Mac Address of the strongest station signal to a text file or maybe in python make it as a variable.</p>
  
  <p>Compare Multiple Stations with different signals (lower number mean strongest). i need to compare signals from this multiple stations and pick the mac address of the strongest signal (ex. -55 vs -60)</p>
  
  <pre><code># awk '/Station/{val=$2;next} /signal/{sub(/^ +/,"");print "MAC Address: "val ORS $0;val=""}'
  
  MAC Address: a8:83:02:cf:3d:e2
          signal:         -60 [-60] dBm
  MAC Address: f4:60:e2:e2:2f:2e
          signal:         -55 [-55] dBm
  </code></pre>
  
  <p>from this i want to get the lowest number(strongest). just need to print only 1 station (mac address)
  <a href="https://i.stack.imgur.com/sBbqP.jpg" rel="nofollow noreferrer">example image</a></p>
  
  <p>--</p>
  
  <p>Latest Code Result (selected signal doesn't match mac address)</p>
  
  <pre><code># iw dev wlan0 station dump | grep -E 'Station|signal' //Reference
  Station a8:8e:08:cf:1d:e9 (on wlan0)    &lt;-------
          signal:         -28 [-28] dBm
  Station f4:20:e2:a8:3f:3e (on wlan0)
          signal:         -55 [-55] dBm
  # sudo iw dev wlan0 station dump | awk //Command
  MAC Address: f4:20:e2:a8:3f:3e          &lt;-------
          signal:         -27 [-28] dBm
  </code></pre>