For my script I have to read the data from a file.
For example I have 2 files: one is a text file, the second is a csv file with 10 columns.
What I am trying to do is to read the csv and change the parameters in the first file.
- Using
sed -nto read the data one row at a time and save this in afileC - Using
sed "s/&replacefile1param/&readFileC/g"
What I have issue is to read the cat of readFileC as a parameter in the second step. How can I do this?
The first file is a sample script file with 2 parameters inside. The second file is a CSV file with 200 lines with 6 columns.
I need to change the template file by reading the columns from the CSV, and substituting the parameters. The result need to be 200 file1 and each result needs to be saved in the location specified in the the 4th column of the CSV as well.
Sample template file
The name =scriptname
The staments go here
job name = jobname
exit
Sample CSV data
scriptname,jobname,date,location,updated,env
kkkkkk,filetest,2001-01-01,/san00/project,test
kkkkk2,filetest2,2001-01-01,/san00/project,test
kkkkk3,filetest3,2001-01-01,/san00/project2,real
I need to replace the parameters in the template file with values taken from the CSV, and save the file in the /san00 location from the 4th column of the CSV.
Desired output
The script name kkkkkk
The staments go here
job name = filetest
exit
This should be saved in san00/project.