eprev / locationchanger

Change OS X’s network location based on the name of Wi-Fi network
404 stars 67 forks source link

Improvement : SSID name extraction #22

Closed bigornoo closed 3 years ago

bigornoo commented 3 years ago

A little bit more simple to read and shorter :)

eprev commented 3 years ago

It's there on purpose to handle SSID with white-spaces.

$ echo " SSID: Hello World" | grep ' SSID' | cut -d : -f 2- | sed 's/^[ ]*//'
Hello World

$ echo " SSID: Hello World" | grep -wi "ssid:" | awk '{print $2}'
Hello