A possible solution will be using:
nmcli -f GENERAL -t dev list | tr '\n' ' ' | grep -oP 'TYPE:\Kgsm.*' | sed 's/GENERAL.TYPE:.*//' | grep -oP 'GENERAL.IP-IFACE:\K\S*'
This command will:
1. Get the `nmcli dev list` output in multiline form, with terse output.
GENERAL.DEVICE:wwan0
GENERAL.TYPE:gsm
GENERAL.VENDOR:Dell
2. Replace the newline with `tr`
3. Get the text after the "TYPE:gsm" pattern
4. Get rid off the text after the next "TYPE" pattern, this will guarantee what we get is the gsm sector.
5. Get the interface name with `grep`
Note that `nmcli dev list` is for Precise, for Xenial, we will need to use `nmcli dev show`
A possible solution will be using: TYPE:.* //' | grep -oP 'GENERAL. IP-IFACE: \K\S*'
nmcli -f GENERAL -t dev list | tr '\n' ' ' | grep -oP 'TYPE:\Kgsm.*' | sed 's/GENERAL.
This command will: DEVICE: wwan0 TYPE:gsm VENDOR: Dell
1. Get the `nmcli dev list` output in multiline form, with terse output.
GENERAL.
GENERAL.
GENERAL.
2. Replace the newline with `tr`
3. Get the text after the "TYPE:gsm" pattern
4. Get rid off the text after the next "TYPE" pattern, this will guarantee what we get is the gsm sector.
5. Get the interface name with `grep`
Note that `nmcli dev list` is for Precise, for Xenial, we will need to use `nmcli dev show`