I have a file abc.csv which is as follows;-
sn,test,control
1,file1,file2
2,file3,file4
i have another configuration file text.cfg as follows:-
model.input1 = /usr/bin/file1
model.input2 = /usr/bin/file2
now i want to replace the file1 and file2 with file3 and file4 respectively and then file5 and file6 and so on,, till the abc.csv file is exhausted
my attempt for the problem is :-
IFS =","
while read NUM TEST CONTROL
X=""
Y=""
do
echo "Serial Number :$NUM"
echo "Test File :$TEST"
echo "Control File:$CONTROL"
sed -i -e 's/$A/$B/g' text.cfg
X = $TEST
Y = $CONTROL
done < abc.csv
the ouput should be new config files as follows:-
this is the test1.cfg:
model.input1 = /usr/bin/file1
model.input2 = /usr/bin/file2
then the second file should be test2.cfg
model.input1 = /usr/bin/file3
model.input2 = /usr/bin/file4
and so on..
IFS =","are wrong, you should paste your script in www.shellcheck.net to clear these errors and then focus on the logic.