I have a CSV with lots of lines delimited by comma. I have to convert it to text.
66012523,39,Feb 02 2015 05:19AM,
66012523,39,Feb 02 2015 09:53AM,
66012523,39,Feb 02 2015 01:38PM,
I used command cp source.csv destination.csv
and also cat source.csv > destination.txt
but it does output in the same format witch each line coming in new one. It just gets appended together. It outputs like
66012523,39,Feb 02 2015 05:19AM,66012523,39,Feb 02 2015 09:53AM,66012523,39,Feb 02 2015 01:38PM
How do I make them to output each line in newline. Please help.
I hypothesise that the first block in your question is what you WANT, and what you actually HAVE is
66012523,39,Feb 02 2015 05:19AM,66012523,39,Feb 02 2015 09:53AM,66012523,39,Feb 02 2015 01:38PM
So what you want to do, I hypothesise, is split this up into separate lines.
Am I right?
This is a bit rough-and-ready but it works. Relies on each group ending "M," and there being no other "M,"s in the text - which there aren't but I wouldn't call it robust.
sed s/M,/'\n'/g source.csv
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.