I have a variable containing a list of of names of several other variables. These variable each contain a table. I want to join all of these tables.
The tables could look something like this:
Name Average Name Average
A 1 A 1.1
B 2 B 2.2
C 3 C 3.3 etc.
D 4 D 4.4
E 5 E 5.5
My list of variable names is called $all_variables and here is what its content looks like (a lot more variables in the real situation):
echo "$all_variables"
$table1
$table2
$table3
$table4
$table5
To create the parameter list for the join function, I created $all_variables_join, which contains the parameters for the join function:
echo "$all_variables_join"
<(echo "$table1") <(echo "$table2") <(echo "$table3") <(echo "$table4") <(echo "$table5")
I then want to run join (based on first column so I am using default options) using something like this:
join "$all_variables_join" > file.txt
Which would be expanded to
join <(echo "$table1") <(echo "$table2") <(echo "$table3") <(echo "$table4") <(echo "$table5") > file.txt
And file.txt would contain something like this:
Name Average
A 1 1.1
B 2 2.2
C 3 3.3 etc...
D 4 4.4
E 5 5.5
However, when I try to run this I get this error:
join "$all_variables_join" > file.txt
join: missing operand after `<(echo "$table1") <(echo "$table2") <(echo "table3") <(echo "$table4") <(echo "$table5")'
Try `join --help' for more information.
Any idea how I could fix this?
Any help is very appreciated!
thanks
EDIT: Fixed the error message, I had copied the wrong one