Skip to content

Instantly share code, notes, and snippets.

@henri
Last active February 21, 2017 23:20
Show Gist options
  • Save henri/fe7ac5ce17e8bc7ff74a68c4c8cfdb96 to your computer and use it in GitHub Desktop.
Save henri/fe7ac5ce17e8bc7ff74a68c4c8cfdb96 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
grep `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/BSSID/{print $2}'` /tmp/file.csv | head -n 1 | awk -F "," '{print $2}'
@wifiprintguy
Copy link

Alternative:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | grep " SSID" | cut -d ':' -f 2 | xargs

@larkost
Copy link

larkost commented Feb 21, 2017

Or one that only uses awk:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/^[ ]+SSID: / {sub(/^[ ]+SSID: /, ""); print}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment