I have to do a discover the available wifi networks by command line. I know the followed command nmcli to list the wifi:
> nmcli dev wifi list | less
which, on my Linux system, gives an output of the followed type:
* 10:7B:44:3E:F0:70 TPLINK-8853 Infra 6 130 Mbit/s 100 **** WPA2
10:7B:44:3E:F0:74 TPLINK-9910 Infra 64 135 Mbit/s 99 **** WPA2
88:9C:AD:2B:95:A5 GUESTS Infra 1 260 Mbit/s 77 *** --
C4:B2:39:96:AA:60 -- Infra 6 195 Mbit/s 60 *** WPA2 802.1X
...
The third column of the previous list contains the SSID of the available wifi networks
The wifi "TPLINK-9910 " has a SSID with a trailing space while the wifi "TPLINK-8853" is without trailing space. I'm quite sure that starting from the output of the previous command it is not possible to get a SSID including the trailing spaces.
Are there any other options for the nmcli command that outputs the SSID of a wifi including, if present, trailing spaces?
EDIT (complete question)
I need also preserve the leading spaces in the SSID so the question to search a complete solution to my problem is:
Are there any other options for the nmcli command that outputs the SSID of a wifi including, if present, trailing spaces and leading spaces?
wpa_clishow the spaces? I know it escapes other unprintables, but space is technically printable: I don't expect that to matter, though, because its output is tab-separated. Tryinterface wlan0(or whatever the correct name is), thenscan_results. It's an interactive program, but perfectly scriptable. If this works, I'll post it as an answer.