Splitting up a csv file into lines
Hi all,
I have a large csv file which linux sees large amounts of it as one line. I've been trying to break it up with sed, from.. (name,address,etc),(name,address,etc),(name,address,etc) into (name,address,etc) (name,address,etc) (name,address,etc) each on their own line.. can this be done with sed? And if not what other commands can I use to do it.. Thanks pulsar.. |
would be nice to see the format of the original file, otherwise hard to say anything (I mean please post a few records of the original file)
|
will get a bit up in a minute..
|
,(11,'acfly','80536195','Ted lander','tshep0001@nowhere.com',1,0,'','','','','','',0,'http://www.bootk
it.com/usericons/acfly.jpg','',0,'',0,0,0,0,0,0,0,'','0','','','',-1,''),(12,'achapman','d8b2212c','Alan Chapman','achapman5@home.com',1,0,'','','','' ,'','',0,'http://www.bootkit.com/usericons/achapman.jpg','',0,'',0,0,0,0,0,0,0,'','0','','','',-1,''),(13,'acidsky','094d114b','AcidSky','a each record is bracketed ( ) and I can get out the extra 00.0.0.0.0. etc - don't know how to break into lines |
The actual record separator is ),( which you want to convert to a standard line ending. In Linux this is just LF (\n) while in the Windows world it is CRLF (\r\n).
Try, for Linux Code:
sed 's/),(/\n/g' <inputfile> Code:
sed 's/),(/\r\n/g' <inputfile> |
Thanks, I'll give it a go
|
All times are GMT -5. The time now is 09:14 PM. |