Simplest is
echo $A"$A" | awk '{print $NF}'
Edit: explanation of how this works...
awk
breaks the input into different fields, using whitespace as the separator by default. Hardcoding 5
in place of NF
prints out the 5th field in the input:
echo $A"$A" | awk '{print $5}'
NF
is a built-in awk
variable that gives the total number of fields in the current record. The following returns the number 5 because there are 5 fields in the string "Some variable has value abc.123"
:
echo $A"$A" | awk '{print NF}'
Combining $
with NF
outputs the last field in the string, no matter how many fields your string contains.