How do I print awk output on the same line.
I am using this to print the resolution of my monitor:
$ xrandr | awk '/\*/{print $1}'
When I connect a second monitor I get output on two lines,
$ xrandr | awk '/\*/{print $1}'
1920x1200
1600x1050
I would like to have the output on the same line. So it will look like this:
Monitor sizes: 1920x1200 1600x1050
How would I do this the simplest way?
I have found this solution that is similar to what anubhava posted.
$ xrandr | awk '/\*/{printf $1" "}'
1920x1200 1600x1050