Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
09-11-2014, 01:01 PM
#1
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Rep:
network script
I really enjoyed writing this script.I don't know about y'all but I have a lot of fun working with Sed, Awk, etc.
Manipulating strings of information with commands always turns out to be a fun puzzle to solve. There are a million ways to approach the problem and a ton of solutions but I like to find the most efficient and effective way possible!
I know there are a few guru's and scripters here in the forums and if you wanted to give it a try, I have a small challenge for you.
Take the output from an iw network scan and end up with the SSID(No label) and it's respective signal strength(Again no label).
Stipulations - You may only use 2 languages and one call to each language.
Code:
iw wlan0 scan | ...
Example output:
Code:
attwifi -44.00
TWCWiFi -73.00
CableWiFi -74.00
Example input:
Code:
BSS 00:a0:f8:42:1e:f2(on wlp2s0)
TSF: 424422401061 usec (4d, 21:53:42)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy (0x0011)
signal: -48.00 dBm
last seen: 120 ms ago
Information elements from Probe Response frame:
SSID: Edc9sse1
Supported rates: 1.0* 2.0* 5.5 11.0
DS Parameter set: channel 6
TIM: DTIM Count 8 DTIM Period 10 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
WPA: * Version: 1
* Group cipher: Use group cipher suite
* Pairwise ciphers:
* Authentication suites: 00-a0-f8:0
BSS 02:1a:11:ff:5f:67(on wlp2s0) -- associated
TSF: 22431717731 usec (0d, 06:13:51)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy SpectrumMgmt ShortSlotTime (0x0511)
signal: -38.00 dBm
last seen: 102 ms ago
Information elements from Probe Response frame:
SSID: AnthonyAP
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
DS Parameter set: channel 6
Country: Q2 Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
Power constraint: 0 dB
TPC report: TX power: 18 dBm
ERP: Use_Protection
ERP D4.0: Use_Protection
RSN: * Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: 16-PTKSA-RC (0x000c)
Extended supported rates: 6.0 9.0 12.0 48.0
HT capabilities:
Capabilities: 0x112d
RX LDPC
HT20
SM Power Save disabled
RX HT20 SGI
RX STBC 1-stream
Max AMSDU length: 3839 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT RX MCS rate indexes supported: 0-7
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 6
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: non-HT mixed
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
Extended capabilities: Extended Channel Switching, 6
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:21:d8:33:8e:10(on wlp2s0)
TSF: 424359715903 usec (4d, 21:52:39)
freq: 2412
beacon interval: 100 TUs
capability: ESS ShortSlotTime (0x0401)
signal: -46.00 dBm
last seen: 4225 ms ago
Information elements from Probe Response frame:
SSID: attwifi
Supported rates: 1.0 2.0* 5.5 6.0 9.0 11.0 12.0 18.0
DS Parameter set: channel 1
ERP: Use_Protection Barker_Preamble_Mode
Extended supported rates: 24.0 36.0 48.0 54.0
WMM: * Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 84:78:ac:e8:ab:83(on wlp2s0)
TSF: 16455776683013 usec (190d, 11:02:56)
freq: 2412
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -61.00 dBm
last seen: 4235 ms ago
Information elements from Probe Response frame:
SSID: CableWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 1
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 6
* channel utilisation: 85/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
HT capabilities:
Capabilities: 0x182c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
Extended supported rates: 48.0 54.0
HT operation:
* primary channel: 1
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: non-HT mixed
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:21:d8:33:8e:11(on wlp2s0)
TSF: 424360038707 usec (4d, 21:52:40)
freq: 2412
beacon interval: 100 TUs
capability: ESS ShortSlotTime (0x0401)
signal: -50.00 dBm
last seen: 3867 ms ago
Information elements from Probe Response frame:
SSID: \x00
Supported rates: 1.0 2.0* 5.5 6.0 9.0 11.0 12.0 18.0
DS Parameter set: channel 1
TIM: DTIM Count 1 DTIM Period 2 Bitmap Control 0x0 Bitmap[0] 0x0
ERP: Use_Protection Barker_Preamble_Mode
Extended supported rates: 24.0 36.0 48.0 54.0
WMM: * Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS ec:e1:a9:31:ec:c1(on wlp2s0)
TSF: 16458406238258 usec (190d, 11:46:46)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -73.00 dBm
last seen: 730 ms ago
Information elements from Probe Response frame:
SSID: xfinitywifi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 53/255
* available admission capacity: 23437 [*32us]
ERP: Use_Protection
HT capabilities:
Capabilities: 0x182c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
Extended supported rates: 48.0 54.0
HT operation:
* primary channel: 11
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: nonmember
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:26:98:ec:a4:03(on wlp2s0)
TSF: 3579458445364 usec (41d, 10:17:38)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -72.00 dBm
last seen: 720 ms ago
Information elements from Probe Response frame:
SSID: CableWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x6 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 4
* channel utilisation: 35/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS ec:e1:a9:31:ec:c3(on wlp2s0)
TSF: 16458406238258 usec (190d, 11:46:46)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -76.00 dBm
last seen: 706 ms ago
Information elements from Probe Response frame:
SSID: CableWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 53/255
* available admission capacity: 23437 [*32us]
ERP: Use_Protection
HT capabilities:
Capabilities: 0x182c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
Extended supported rates: 48.0 54.0
HT operation:
* primary channel: 11
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: nonmember
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:23:68:8d:6e:30(on wlp2s0)
TSF: 5061556049372 usec (58d, 13:59:16)
freq: 2462
beacon interval: 100 TUs
capability: ESS Privacy ShortSlotTime (0x0411)
signal: -68.00 dBm
last seen: 731 ms ago
SSID: M0b1l3p
Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0
DS Parameter set: channel 11
Country: US Environment: Indoor only
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 20/255
* available admission capacity: 2365 [*32us]
ERP: <no flags>
RSN: * Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: (0x0000)
Extended supported rates: 24.0 36.0 48.0 54.0
BSS 00:15:ff:8d:56:99(on wlp2s0)
TSF: 10666701184 usec (0d, 02:57:46)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
signal: -88.00 dBm
last seen: 149 ms ago
Information elements from Probe Response frame:
SSID: Verizon-MiFi5510L-5699
Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0
DS Parameter set: channel 6
TIM: DTIM Count 3 DTIM Period 5 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: bogus
Channels [1 - 11] @ 27 dBm
ERP: Use_Protection
Extended supported rates: 24.0 36.0 48.0 54.0
HT capabilities:
Capabilities: 0x2c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 3839 bytes
No DSSS/CCK HT40
Maximum RX AMPDU length 8191 bytes (exponent: 0x000)
Minimum RX AMPDU time spacing: No restriction (0x00)
HT RX MCS rate indexes supported: 0-7
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 6
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: nonmember
* non-GF present: 0
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
RSN: * Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: (0x0000)
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 68:7f:74:bc:6e:08(on wlp2s0)
TSF: 424406528403 usec (4d, 21:53:26)
freq: 2437
beacon interval: 100 TUs
capability: ESS ShortSlotTime (0x0401)
signal: -84.00 dBm
last seen: 216 ms ago
Information elements from Probe Response frame:
SSID: IrwinLM
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
DS Parameter set: channel 6
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x40
ERP: Barker_Preamble_Mode
ERP D4.0: Barker_Preamble_Mode
Extended supported rates: 6.0 9.0 12.0 48.0
HT capabilities:
Capabilities: 0x187c
HT20
SM Power Save disabled
RX Greenfield
RX HT20 SGI
RX HT40 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 6
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 1
* HT protection: nonmember
* non-GF present: 1
* OBSS non-GF present: 1
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WPS: * Version: 1.0
* Wi-Fi Protected Setup State: 2 (Configured)
WMM: * Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 84:78:ac:e8:ab:81(on wlp2s0)
TSF: 16458371143730 usec (190d, 11:46:11)
freq: 2412
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -61.00 dBm
last seen: 4260 ms ago
Information elements from Probe Response frame:
SSID: xfinitywifi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 1
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 5
* channel utilisation: 87/255
* available admission capacity: 23437 [*32us]
ERP: Use_Protection
HT capabilities:
Capabilities: 0x182c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
Extended supported rates: 48.0 54.0
HT operation:
* primary channel: 1
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: nonmember
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:11:93:1f:67:e0(on wlp2s0)
TSF: 5061609674764 usec (58d, 14:00:09)
freq: 2412
beacon interval: 100 TUs
capability: ESS ShortSlotTime (0x0401)
signal: -82.00 dBm
last seen: 4237 ms ago
Information elements from Probe Response frame:
SSID: attwifi
Supported rates: 1.0 2.0* 5.5 6.0 9.0 11.0 12.0 18.0
DS Parameter set: channel 1
ERP: Use_Protection Barker_Preamble_Mode
Extended supported rates: 24.0 36.0 48.0 54.0
WMM: * Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:26:98:ec:a4:02(on wlp2s0)
TSF: 3579458340916 usec (41d, 10:17:38)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -73.00 dBm
last seen: 769 ms ago
Information elements from Probe Response frame:
SSID: TWCWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x6 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 4
* channel utilisation: 35/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:23:ac:18:b7:02(on wlp2s0)
TSF: 16458345867316 usec (190d, 11:45:45)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -70.00 dBm
last seen: 759 ms ago
Information elements from Probe Response frame:
SSID: TWCWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x2 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 37/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS ec:e1:a9:31:ec:c2(on wlp2s0)
TSF: 16458406238258 usec (190d, 11:46:46)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -75.00 dBm
last seen: 755 ms ago
Information elements from Probe Response frame:
SSID: TWCWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 53/255
* available admission capacity: 23437 [*32us]
ERP: Use_Protection
HT capabilities:
Capabilities: 0x182c
HT20
SM Power Save disabled
RX HT20 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-15
HT TX MCS rate indexes are undefined
Extended supported rates: 48.0 54.0
HT operation:
* primary channel: 11
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: nonmember
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:26:98:ec:a4:01(on wlp2s0)
TSF: 3579458340916 usec (41d, 10:17:38)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -72.00 dBm
last seen: 744 ms ago
Information elements from Probe Response frame:
SSID: xfinitywifi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x6 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 4
* channel utilisation: 35/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:23:ac:18:b7:01(on wlp2s0)
TSF: 16458345867316 usec (190d, 11:45:45)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -69.00 dBm
last seen: 737 ms ago
Information elements from Probe Response frame:
SSID: xfinitywifi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x2 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 37/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:23:ac:18:b7:03(on wlp2s0)
TSF: 16458345971764 usec (190d, 11:45:45)
freq: 2462
beacon interval: 102 TUs
capability: ESS ShortPreamble ShortSlotTime (0x0421)
signal: -70.00 dBm
last seen: 712 ms ago
Information elements from Probe Response frame:
SSID: CableWiFi
Supported rates: 5.5 6.0* 9.0 11.0 12.0 18.0 24.0 36.0
DS Parameter set: channel 11
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x2 Bitmap[0] 0x0 (+ 3 octets)
Country: US Environment: Indoor/Outdoor
Channels [1 - 11] @ 30 dBm
BSS Load:
* station count: 0
* channel utilisation: 37/255
* available admission capacity: 23437 [*32us]
ERP: <no flags>
Extended supported rates: 48.0 54.0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
My solution ->
Code:
iw wlp2s0 scan | awk '/SSID|signal/{print $2}' | sed -e 'N;s/\n/ /;s/\(\-[0-9.]*\)\(.*\)\([a-zA-Z0-9]*\)/\2 \1/';
.
Last edited by amboxer21; 09-11-2014 at 04:01 PM .
09-11-2014, 01:36 PM
#2
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
I don't have a wireless card available, do you have an example input?
09-11-2014, 01:58 PM
#3
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
moved sample output to OP. PLease delete this and post below.
Last edited by amboxer21; 09-11-2014 at 04:02 PM .
09-11-2014, 02:13 PM
#4
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Not needed
Last edited by amboxer21; 09-11-2014 at 02:41 PM .
09-11-2014, 02:42 PM
#5
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552
Mmh, 1 language and 1 call possible?
Code:
iw wlan0 scan | perl -ne '$s=$1 if /signal: (-?.*) dBm/;print "$1 $s\n" if /SSID: (.*)/;'
1 members found this post helpful.
09-11-2014, 04:05 PM
#6
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
Very nice,. looking at your regex though, i see a couple of things I would change:
Quote:
sed -e 'N;s/\n/ /;s/\(\-[0-9.] *\)\(.*\)\([a-zA-Z0-9] *\)/\2 \1/';
escape the dot
use .* for 'a-zA-Z0-9'
Code:
sed -e 'N;s/\n/ /;s/\(\-[0-9\.] *\)\(.*\)\([.*] *\)/\2 \1/';
Last edited by szboardstretcher; 09-11-2014 at 04:06 PM .
09-11-2014, 07:25 PM
#7
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Quote:
Originally Posted by
szboardstretcher
Very nice,. looking at your regex though, i see a couple of things I would change:
escape the dot
use .* for 'a-zA-Z0-9'
Code:
sed -e 'N;s/\n/ /;s/\(\-[0-9\.] *\)\(.*\)\([.*] *\)/\2 \1/';
I didn't think it was necessary to escape the dot since the dot covers one letterz character or number and that character was literally a dot lol either way works. I did over look the [a-zA-Z0-9] regex though. Nice eye!
09-11-2014, 08:45 PM
#8
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313
09-11-2014, 10:09 PM
#9
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Quote:
Originally Posted by
schneidz
Related in what way? I am writing my own network manager in bash but I have no clue who that guy is. Related? No. Similar? Yes. He's not the first guy out there to do this.
09-12-2014, 11:30 AM
#10
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
I thought what I posted was pretty straight forward and fairly easy! Instead I get no replies and the thread is left for dead.
I definitely feel the love here. <- lots of sarcasm
09-12-2014, 06:21 PM
#11
Senior Member
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780
Code:
awk -F': ' '$1 ~ /^ *signal$/{ sig = $2 } $1 ~ /^ *SSID$/{ print $2, sig }'
But you did get replies?
1 members found this post helpful.
09-17-2014, 06:07 PM
#12
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Quote:
Originally Posted by
ntubski
Code:
awk -F': ' '$1 ~ /^ *signal$/{ sig = $2 } $1 ~ /^ *SSID$/{ print $2, sig }'
But you did get replies?
Meh, not many. From what I remember, this forum has some great scripters. I figured I would have gotten more replies than I did. Thanks everyone.
09-18-2014, 03:48 AM
#13
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005
I am a little confused (could just be me).
I ran the original script posted:
Code:
awk '/SSID|signal/{print $2}' input_file | sed -e 'N;s/\n/ /;s/\(\-[0-9.]*\)\(.*\)\([a-zA-Z0-9]*\)/\2 \1/'
And my 'input_file' contains the data from OP. The output I received was:
Code:
-48.00e1
-38.00yAP
-46.00i
-61.00iFi
-50.00
-73.00ywifi
-72.00iFi
-76.00iFi
-68.00p
-88.00n-MiFi5510L-5699
-84.00M
-61.00ywifi
-82.00i
-73.00i
-70.00i
-75.00i
-72.00ywifi
-69.00ywifi
-70.00iFi
So my query is, I thought the output was supposed to look like:
Code:
attwifi -44.00
TWCWiFi -73.00
CableWiFi -74.00
09-18-2014, 07:28 PM
#14
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Quote:
Originally Posted by
grail
I am a little confused (could just be me).
I ran the original script posted:
Code:
awk '/SSID|signal/{print $2}' input_file | sed -e 'N;s/\n/ /;s/\(\-[0-9.]*\)\(.*\)\([a-zA-Z0-9]*\)/\2 \1/'
And my 'input_file' contains the data from OP. The output I received was:
Code:
-48.00e1
-38.00yAP
-46.00i
-61.00iFi
-50.00
-73.00ywifi
-72.00iFi
-76.00iFi
-68.00p
-88.00n-MiFi5510L-5699
-84.00M
-61.00ywifi
-82.00i
-73.00i
-70.00i
-75.00i
-72.00ywifi
-69.00ywifi
-70.00iFi
So my query is, I thought the output was supposed to look like:
Code:
attwifi -44.00
TWCWiFi -73.00
CableWiFi -74.00
Works for me.
09-19-2014, 01:14 AM
#15
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 291
Original Poster
Rep:
Quote:
Originally Posted by
grail
.
Look at the screen shot I took. Not sure why you've obtained different results.
Last edited by amboxer21; 09-19-2014 at 01:22 AM .
All times are GMT -5. The time now is 07:03 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News