How to read a CSV file using shell script at granular level? -


my sample csv file is:

test1,a=1,b=2   test2,c=3,d=4 

i can fields test1 a=1 b=2 using

while read f1 f2 f3       echo $f1       echo $f2       echo $f3   done < filename.csv   

but want read a=1 separately , save a in param1 , 1 in param2. want f2 & f3 1 one.

could me in this?

you can set ifs comma or equals, this:

while ifs=",=" read b c d e     echo $a    echo $b    echo $c    echo $d    echo $e done < file 

output

test1  1  b 2 test2 c 3  d 4 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -