I'll answer your question with a question, who's variable is $val in the following line:
Code:
v1=`echo $STR | awk '{print $val;}'`
By who I mean awk or bash? If you answer this you will have your answer, at least in part.
I will also assume that you were just using the echoes to check the data but are aware that the extra val variable is not required. At least
not if it is not to have any life past the awk.
Lastly, not understanding what the STR represents, have you thought of just putting it in an array and then using the appropriate indices? (ie no awk required at all)