I have a dynamic output. Like this sometimes:
F8:XX:94:XX:C2:XX 1 39% No ANY_NAME A2:XX:34:XX:E8:XX 6 42% Yes ANY_OTHER_NAME D1:XX:78:XX:A1:XX 6 24% No MORESTUFF Or like this other times:
F8:XX:94:XX:C2:XX 1 433 39% No ANY NAME A2:XX:34:XX:E8:XX 6 232 42% No ANY_OTHER_NAME D1:XX:78:XX:A1:XX 6 112 22% Yes MORE STUFF As you can see the last column is what I want but it can contain spaces or not and the number of columns is dynamic.
I need to capture the value of the last column always in case of having no spaces or having multiple spaces. Sometimes, the column number is dynamic too but the data I want is always in last place having spaces or not. The column before this data it's always a "Yes" or "No" (not sure if this can help).
Is there a way to do it with awk? This is what I have actually:
myvar=$(echo "${line}" | awk '{print $NF}') But with this is taking just the last part after a space, not the complete data. So this is working only if the data has no spaces.
What I want is to get always the last data complete with its spaces in case of containing them. Any help?