#!/bin/sh # 20101123: Update to match the new iwlist output format. # 20080304: Initial release. IWLIST=/sbin/iwlist # List wireless interfaces ifaces=`LANG=C $IWLIST scan 2>/dev/null | grep "Scan completed" | awk '{print $1}' | tr '\n' ' '` # Choose only the first one iface=`echo $ifaces | awk '{print $1}'` # Extract informations and format output (echo ESSID~~~Channel~~~Quality~~~Encryption && \ echo "---~~~---~~~---~~~---" && \ $IWLIST $iface scan | \ sed -n -e 's/.*ESSID:\(.*\)/\1/p' \ -e 's/.*Channel:\([^ ]*\)/~~~\1/p' \ -e 's/Encryption key:\(.*\)/~~~\1/p' \ -e 's/.*Quality:\([^ ]*\)\/100.*/~~~\1/p' | \ xargs -n4 echo) | \ \ awk -F~~~ '{print $1 "~~~" $4 "~~~" $3 "~~~" $2}' | \ column -ntx -s ~~~