I have a CSV with 130 cols and i need to do 3 csv with that. I'm looping with a while and IFS because i need to do someting with the vars on each row.
Here what i did :
while IFS=";" read [my 130 vars]
[what i do with the vars]
done < file.csv
But i have a problem on some rows because the original csv i receive is like :
"Hi";"i";"got;a problem"
As you can see i have a problem with a ; in a value. And the IFS read it as the separation of two values. So here is my question : is there a way to take ";" as the separator instead of just ; ?
if you are OK with
perl
, then:I am sure there should be a way to achieve the same with
awk
I could manage with
sed
:You could use
awk
:For your input, it'd produce:
(I doubt if it's possible to achieve the desired result using
bash
, i.e. by manipulatingIFS
.)