I have a txt file with some comma separated values.
cat file.txt
abc,def,ghi
abc,ghi
def,abc,ghi
def,abc
abc,def
abc,def,ghi
I want to print these values with while do read line from file separated by comma.
Eg:
expecting output for Line no 1:
first col=abc
second col=def
third col=ghi
expecting output for Line no 2:
first col=abc
second col=ghi
If the line has three values then the read line should print
first col=value
second col=value
third col=value
else
first col=value
second col=value
How can I create this shell script?