Skip to main content
added 182 characters in body
Source Link
kenn
  • 783
  • 2
  • 12
  • 23

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

EDIT2:

Actually I could try the following awk line:

  echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" |  awk -F'[:]' '{if (NR>1) print $2}'

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

EDIT2:

Actually I could try the following awk line:

  echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" |  awk -F'[:]' '{if (NR>1) print $2}'
deleted 4 characters in body
Source Link
kenn
  • 783
  • 2
  • 12
  • 23

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

    echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

    echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....
added 459 characters in body
Source Link
kenn
  • 783
  • 2
  • 12
  • 23

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

    echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

I have the following xdotool output from the shell:

Window 98566146
  Position: 5,279 (screen: 0)
  Geometry: 960x480

I want it to be :

 x=5
 y=279
 width=960
 height=480

with awk, sed, or other tools.

CLARIFICATION: I want to format output of xdotool search --sync --class mpv getwindowgeometry the way I described above using regular expression replace techniques via awk, sed or other tools. There is an example in the following link sed/awk replace a specific pattern under another pattern.

Such as

    echo -e "Window 98566146\n  Position: 5,279 (screen: 0)\n  Geometry: 960x480\n" | awk ....
Source Link
kenn
  • 783
  • 2
  • 12
  • 23
Loading