I am trying to parse a csv file, where input is enclosed in '"' and separated by comma ',' with the below code:
split($0,data,",")
print "\""data[1]"\",\""data[7]"\",\""data[2]
It should take columns separately, perform operations if needed, so don't advise to print as is ;) So problem is the last column - its grabbed with '\n' symbol, so the next column overwrites my current line, initial file:
"00:00:00","87100","2381","",""," ","13"
"00:00:01","56270","0098","",""," ","37"
"00:00:01","86917","0942","",""," ","12"
so instead of this:
"00:00:00","13","87100"
"00:00:01","37","56270"
"00:00:01","12","86917"
I'm getting this:
","87100"
","87100"
","87100"
("data[1]","data[3) is being overwritten. I have removed last column from print list, and it worked fine. And also, I can't add commas after the last column, that is too much. Any other advises on code?