Skip to content

Instantly share code, notes, and snippets.

@mael
Created March 13, 2016 11:38
Show Gist options
  • Save mael/2a62e1ee67fbbe525bd3 to your computer and use it in GitHub Desktop.
Save mael/2a62e1ee67fbbe525bd3 to your computer and use it in GitHub Desktop.
WIFI scan command linux
#Option 1
sudo iwlist wlan0 scan | grep -oE '(ESSID:|Quality=).*'
#Option 2
Create a bash file to filter command iwlist
#!/bin/bash
## print header lines
echo ""
echo "ESSID QUALITY"
while IFS= read -r line; do
## test line contenst and parse as required
[[ "$line" =~ Quality ]] && {
qual=${line##*ity=}
qual=${qual%% *}
lvl=${line##*evel=}
lvl=${lvl%% *}
}
[[ "$line" =~ ESSID ]] && {
essid=${line##*ID:}
echo " $essid $qual" # output after ESSID
}
done
#command execute -> sudo iwlist wlan0 scan | bash parseiwl.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment