I have a csv that I’m converting to JSON using csv2json. I’ve encountered a problem after changing my script and discovered its because of my line endings.
When I try to convert my csv (original.csv) to json, I get an error because of the line endings. So I opened up the csv in Coda (the text editor I’m using), and chose “Convert to CRLF”, saved the file, then re-ran csv2json. It worked.
My question is, how can I convert original.csv to CRLF in a bash script?
I tried using sed with no luck:
sed 's/$'"/`echo \\\r`/" original.csv > new.csv
Thank you
Ended up using perl: