There are three main files test.cnf test.sh test.txt
Execute test.sh to read the configuration of test.cnf to modify the content of test.txt. During the execution, the configuration is read successfully but sed is executed. The time was not found.
sed is just debugging here without modifying test.txt, it just displays the results of test.txt
[root@localhost /tmp]# head -100 test*
==> test.cnf test.sh test.txt
Execution errors are displayed during debugging;
[root@localhost /tmp]# bash -x test.sh
+ myconf
+ source test.cnf
++ yy=123
++ ppp=456
+ read myline
+ awk -F= '{print $1}' test.cnf
test.sh: line 4: s/{{$myline}}/${$myline}/g: bad substitution 1 answers
while read a b;do sed -n "s/$a/$b/p" test.txt;done < <(awk -F= '{print ,}' test.cnf)

Other methods:
awk -F= -vOFS='=' 'NR==FNR{a[]=;next}{for(i in a)if( ~ i)sub(i,a[i],)}1' test.cnf test.txt
Hot tools Tags
Hot Questions
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
20524
7
13636
4






