Bash - Reading csv delimited file to array and for further manipulation
Hello,
I am trying to do this:
1. Read csv delimited file line1 and store all values in array
2. Use the values stored in the array and replace values in other text file with them
3. read line2 in the cvs file and repeat the process
4. Do above for all lines in the cvs file
for example:
file1.cvs content:
text1,text2,text3,"text 4"
a1,a2,3,"a 4"
file.txt content:
some text $array1$ some text
some text $array2$ some text
1. read line 1 - text1,text2,text3,"text 4"
put each value in array X[]
lines that contain spaces in cvs will have double quotes
2. read x[1] and replace value $array1$ (in file.txt) with x[1]
read x[2] and replace value $array2$ (in file.txt) with x[2] and so on
Can above be accomplished in BASH and how?
|