Problem: I have dmesg | grep ttyUSB
command that has the following output:
[ 7.648896] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 7.649091] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 7.649502] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB2
[17406.327030] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[17406.329670] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[17406.334036] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[90128.405694] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[90128.405987] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB1
[90128.406295] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB2
[90132.905458] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB3
[90132.905791] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB4
[90132.906541] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB5
[90148.661532] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB6
[90148.661828] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB7
[90148.662440] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB8
need to redirect this output to a text file, I am using the following command for this:
dmesg | grep ttyUSB > test.txt
Everything works fine, but I need only list the available ports. I wish the text file output to be like this:
ttyUSB0
ttyUSB1
ttyUSB2
ttyUSB3
How can I do this?