Skip to content

Instantly share code, notes, and snippets.

@ChatchaiJ
Created July 19, 2017 10:12
Show Gist options
  • Save ChatchaiJ/815ac1b1181e70e7d05567e976622d32 to your computer and use it in GitHub Desktop.
Save ChatchaiJ/815ac1b1181e70e7d05567e976622d32 to your computer and use it in GitHub Desktop.
Scan WiFi using iwlist, get rid of those parts that we don't interested
#!/bin/sh
IFS=''
sudo iwlist wlan0 scanning |\
grep -E 'Quality|Cell|ESSID' |\
while read line; do
printf "%s" $line
ISESSID=`echo $line | grep ESSID`
[ "$ISESSID" ] && printf "\n"
done |\
sed -e 's/ \+/ /g' \
-e 's/\w\+=//g' \
-e 's/ Cell //' \
-e 's/ - Address://' \
-e 's/ Signal//' \
-e 's/dBm ESSID://'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment