When I run the following command it returns me the information of my current mouse:-
JavaScript
x
$ xinput --list | grep "Mouse"
⎜ ↳ A4Tech USB Mouse id=13 [slave pointer (2)]
What command should I execute (maybe along with some regex) that I can get an output 13
(in current case).
Something like this:-
JavaScript
$ xinput --list | grep "Mouse" | ANOTHER_COMMAND
13
Advertisement
Answer
JavaScript
xinput --list | grep "Mouse" |grep -oP 'id=K.*?(?=s)'
Or even shorter :
JavaScript
xinput --list |grep -oP 'Mouse.*id=K.*?(?=s)'