Help needed in function calling in a script

:confused:Hi ,

I have a script as shown below:

rpttxt()
{
name="$*"
awk '/'"${name}"'/ {print $2 $3"=" $4}' file.txt

}

xx = rpttxt "COL_HEAD_1"
awk 'BEGIN {printf("%36s \n ","'"$xx"'")}'

rpttxt() is a function..I want to store the final result of this function in the variable "xx" and print this in a specific format..
When i run this script i get an error : line 8: xx: command not found
Is their any error in calling the function ..?

Thanks in advance

JS

I have solved it
Condiser the thread closed..
Thanks
JS

Good that you solved it but, it is better to post that how did you solve it...! Atleast the next one like me (dumb) will get to know the solution :slight_smile:

Thanks in advance.

-ilan

The script is :
rpttxt()
{
name="$*"
awk '/'"${name}"'/ {print $2 $3"=" $4}' file.txt

}

xx = rpttxt "COL_HEAD_1"
awk 'BEGIN {printf("%36s \n ","'"${xx}"'")}'

Actually the problem was with my file.txt It had got some quotes in it due to which the script didnt run properly.