I have Linux machine red-hat 5.1 and I ask the following question
my target is to create new output_file.txt file from answer_file.txt according to data_file.txt
as we see here I run first the data_file.txt and export all parameters from the file then I try to print all answer_file.txt in to new file output_file.txt
so I will get this file with the new parameters from data_file.txt but I not success -:(
please advice how to export the parameters from data_file.txt in to answer_file.txt and then create new file with the correct values?
remark - I work with bash and I not want to use sed or awk for this task , and I not want to change the content of the original data_file.txt or answer_file.txt ( I need the simple way from bash shell to do the Job )
[root@test1a /var/tmp]# more data_file.txt
arg1=a
arg2=b
arg3=c
[root@test1a /var/tmp]# more answer_file.txt
param1=$arg1
param2=$arg2
param3=$arg3
[root@test1a /var/tmp]# . ./data_file.txt
[root@test1a /var/tmp]# export arg1 arg2 arg3
[root@test1a /var/tmp]# cat ` . ./answer_file.txt ` >/var/tmp/output_file.txt
-bash: ./answer_file.txt: line 4: unexpected EOF while looking for matching `''
-bash: ./answer_file.txt: line 5: syntax error: unexpected end of file
( my target is to get: Example of expected results from output_file.txt )
more answer_file.txt
param1=a
param2=b
param3=c