Вот еще одно решение.
import re
interface_info = '''Interface wlan1-cabin-2
ifindex 37
wdev 0x300000003
addr 06:53:1a:4e:07:02
ssid SSID3
type AP
channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz'''
mac_address = re.search(r'(addr)\s.+', interface_info)
ssid_match = re.search(r'(ssid)\s.+', interface_info)
interface_type = re.search(r'(type)\s.+',interface_info)
channel_info = re.search(r'(channel).+',interface_info)
split_channel_info = re.split(r'\,', channel_info.group(0))
print (str(mac_address.group(0)).lstrip('addr'))
print (str(ssid_match.group(0)).lstrip('ssid'))
print (str(interface_type.group(0)).lstrip('type'))
print(str(split_channel_info[0]).strip())
print(str(split_channel_info[1]).strip())
print(str(split_channel_info[2]).strip())
Вот еще одно решение, которое было предложено ранее.
import re
interface_info = '''Interface wlan1-cabin-2
ifindex 37
wdev 0x300000003
addr 06:53:1a:4e:07:02
ssid SSID3
type AP
channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz'''
interface_regex = re.compile('wdev +0x300000003(.*)\naddr(.*)\nssid(.*)\ntype(.*)\nchannel(.*)')
interface_extract = re.search(interface_regex,interface_info)
interface_split = re.split(r'\n', interface_extract.group(0))
mac_address = str(interface_split[1]).strip('addr')
ssid = str(interface_split[2]).strip('ssid')
interface_type = str(interface_split[3]).strip('type')
channel_info = interface_split[4]
split_channel_info = re.split(r'\,', channel_info)