2

In Raspbian when I'm running command iwlist wlan0 scan | grep ESSID i'm getting results without SSID on it like below

            ESSID:"OpenWrt"
            ESSID:"dlink"
            ESSID:"tplink"
            ESSID:"linksys"
            ESSID:"tenda"
            ESSID:"pi"
            ESSID:""
            ESSID:"somessid"
            ESSID:""
            ESSID:"router"
            ESSID:""
            ESSID:""
            ESSID:""

I don't why I getting this blank SSID lines. my work environment may have some hidden network. not sure. but I need to remove this before send to front end processing. how can I achieve this

3
$ iwlist wlan0 scan | grep 'ESSID:"..*"'
            ESSID:"OpenWrt"
            ESSID:"dlink"
            ESSID:"tplink"
            ESSID:"linksys"
            ESSID:"tenda"
            ESSID:"pi"
            ESSID:"somessid"
            ESSID:"router"
  • . meta character matches any character
  • .* will match zero or more characters
  • Can also use grep -E 'ESSID:".+"' which will match at least one character between the double quotes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.