0

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".

1
  • 2
    Hello and welcome to StackOverflow. Please edit your question to include the output of xrandr -q. Commented Sep 11, 2018 at 12:32

1 Answer 1

3

Yes, in awk you can combine conditions using logical operators && || !

Ex.

xrandr | awk '/ connected/ && !/primary/' 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.