Created
August 14, 2013 10:33
-
-
Save breunigs/6229856 to your computer and use it in GitHub Desktop.
prints a sorted list of nearby wlans.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#sudo iwlist wlan0 scan | \ # find all nearby wlans | |
# grep -E 'Freq|Quality|ESSID' | \ # select details we care about | |
# tr '\n' ' ' | \ # remove newlines for easier sed parsing | |
# sed -r 's/\s+/ /g' | \ # remove superflous spaces | |
# sed 's/:/: /g' | \ # add a space after each colon (in our case after "Frequency") | |
# sed -r 's/( [1-9]\))/ \1/g' | \ # Indent 1-digit channels so they line up nicely | |
# sed 's/ Freq/\nFreq/g' | \ # re-add newlines (one line for each wlan) | |
# sed -r 's/(Quality|Signal|ESSID)/\t\1/g' | \ # tab output so it lines up | |
# sort | \ # well… | |
# tail -n +2 # cut the leading empty lines | |
sudo iwlist wlan0 scan | \ | |
grep -E 'Freq|Quality|ESSID' | \ | |
tr '\n' ' ' | \ | |
sed -r 's/\s+/ /g' | \ | |
sed 's/:/: /g' | \ | |
sed -r 's/( [1-9]\))/ \1/g' | \ | |
sed 's/ Freq/\nFreq/g' | \ | |
sed -r 's/(Quality|Signal|ESSID)/\t\1/g' | \ | |
sort | \ | |
tail -n +2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment