c需要数据处理求大神解答

root@OpenWrt:~# iw dev wlan0 station dump

Station e0:ac:cb:b1:ca:ba (on wlan0)

        inactive time: 27010 ms

        rx bytes: 198087

        rx packets: 1417

        tx bytes: 843928

        tx packets: 969

        tx retries: 66

        tx failed: 4

        signal: -70 dBm

        signal avg: -70 dBm

        tx bitrate: 72.2 MBit/s MCS 7 short GI

        rx bitrate: 24.0 MBit/s

        expected throughput: 34.84Mbps

        authorized: yes

        authenticated: yes

        preamble: short

        WMM/WME: yes

        MFP: no

        TDLS peer: no

Station 04:52:f3:87:cf:77 (on wlan0)

        inactive time: 620 ms

        rx bytes: 316840

        rx packets: 3260

        tx bytes: 419569

        tx packets: 1576

        tx retries: 91

        tx failed: 0

        signal: -78 dBm

        signal avg: -79 dBm

        tx bitrate: 144.4 MBit/s MCS 15 short 

我需要把不固定的这种station数据根据对应的名称获取:后面的数据怎么处理呀

提示一下思路,把上述结果存放在文件中,然后按行遍历,首先要输入的条件就是mac地址,先找到mac地址所在的行,然后进行后续解析,再查找关键字符串,直到查找到关键字符串,或者查找到下一个Station,或者查找到结束为止。

可以试一下正则表达式