(using GNU sed)
I want to grab some output from xrandr and leave out everything but the resolution and offset.
Input:
eDP1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 290mm x 160mm
1366x768 60.02*+
1280x720 59.74
...
640x360 59.84 59.32 60.00
HDMI1 connected primary 2560x1440+1366+0 (normal left inverted right x axis y axis) 610mm x 350mm
3840x2160 30.00 + 25.00 24.00 29.97 23.98
2560x1440 59.95*
...
720x400 70.08
Desired output:
1366x768+0+0
2560x1440+1366+0
This is my current command:
xrandr | sed -e '/^\ /d' -e 's/.*\(\<.*x[0-9]*+[0-9]*+[0-9]*\).*/\1/'
The first expression deletes all the lines that begin with spaces, leaving
eDP1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 290mm x 160mm
HDMI1 connected primary 2560x1440+1366+0 (normal left inverted right x axis y axis) 610mm x 350mm
Then the second expression find the resolution/offset and throws away everything else.
How could I make the regex cleaner?