in reply to splitting cvs file without line breaks
Well, based on the sample snippet, there's was a line break just before each date, right? You could try
perl -pi.bak -e 's/ *(?:\d{4}-\d{2}-\d{2})/\r\n/g' filename
That inserts CRLF before the date at all instances and saves the original to filename.bak - see perlrun.
update: Oops, typo. I mean
perl -pi.bak -e 's/ *(?=\d{4}-\d{2}-\d{2})/\r\n/g' filename
Thanks, johngg!
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: splitting cvs file without line breaks
by johngg (Canon) on May 15, 2007 at 19:17 UTC | |
|
Re^2: splitting cvs file without line breaks
by Skeeve (Parson) on May 15, 2007 at 20:28 UTC | |
by shmem (Chancellor) on May 15, 2007 at 21:11 UTC |