I am trying to get the monitor name of my secondary monitors using xrandr -q. I am able to get the primary using xrandr -q | awk '/primary/{print $1}', but I also want to get the secondary monitors. I have tried xrandr -q | awk '/ connected/{print $1}', but that also includes the primary. Is there a way that I can do a combo of these two commands (but the first in reverse), where it will show all with "connected" and exclude the one with "primary".
- 2Hello and welcome to StackOverflow. Please edit your question to include the output of xrandr -q.Panki– Panki2018-09-11 12:32:25 +00:00Commented Sep 11, 2018 at 12:32
Add a comment |
1 Answer
Yes, in awk you can combine conditions using logical operators && || !
Ex.
xrandr | awk '/ connected/ && !/primary/'