

This produces: -77.00 dBm nameOfAccessPoint1 With paste we join two consecutive lines with a space in between.

To make the fact that the SSID is unknown explicit, we replace the single space with. Note that the access point with signal strength -69 dBm doesn't broadcast an SSID, the output of grep is a single space on that line.

Reduces the output of iw wlan0 scan to something like this: -77.00 dBm See this answer to learn more about the used options and \K. Grep gets the text after "signal:" or "SSID:". Scan for access points reachable via interface wlan0. This command sorts access points by signal strength, strongest first: sudo iw wlan0 scan | grep -Po '(signal|SSID):\K.*' | sed 's/ $/ /' | paste -d ' ' - | cut -c2- | sort -gr I don't have nm-tool installed so I use iw.
