Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word $2, or preferably the next-to-last $(NF-1) if you might have parentheses in the device name:
awk -F '[()]' '/Mouse/{print $($NFNF-1)}'
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word $2, or preferably the next-to-last $(NF-1) if you might have parentheses in the device name:
awk -F '[()]' '/Mouse/{print $($NF-1)}'
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word $2, or preferably the next-to-last $(NF-1) if you might have parentheses in the device name:
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word$2, or preferably the next-to-last $(NF-1) if you might have parentheses in the device name:
awk -F '[()]' '/Mouse/{print $2$($NF-1)}'
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word:
awk -F '[()]' '/Mouse/{print $2}'
Use awk to match the line and split it into words separated by ( or ). Take the 2nd word$2, or preferably the next-to-last $(NF-1) if you might have parentheses in the device name: