Q:

Splitting output into two variables

I am trying to read raspberry pi resolution using the tvservice command into two variables: X & Y. 
When running:
tvservice --status | awk '{print $9}'

I am getting:
1920x1800 

Which is exactly what I am looking for. 
What I am trying to figure out, is how to split them into two bash variables where X=1920 and Y=1800 so I can use them later on in my script. 

A:

Could you please try following.  Where simply we create 2 variables named X and Y and in spite of printing the $9 we are splitting it with using split function of awk and then printing their 1st element for variable X and 2nd element for 2nd element. 
X=$(tvservice --status | awk '{split($9,array,"x");print array[1]}')
Y=$(tvservice --status | awk '{split($9,array,"x");print array[2]}')

