I have value which stores the present resolution, such as: $2 = 1920x1080. I would like to split the value based on the x
character and store the result in 2 variables. With the example above, the first variable will store 1920 and the second 1080. I would then like to make the definition for a print command based on these two valyues.
What is the best way to do this?
awk '{ res=$2 split(res,resArr,"x") print "resX=" resArr[1] "\tresY="resArr[2] }' inFile
If I understand your needs correctly.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With