OT: splitting csv file

scooter6 at gmail.com scooter6 at gmail.com
Wed Jan 8 06:38:39 PST 2014


I have a csv file that looks something like this:

12/5/2013,14:12,,1,2,3,14160.00,,,,profdm1,,,property,   etc
12/5/2013,14:12,,1,2,3,14160.00,,,,,,,,property, etc

There are and can be several lines in this file.

What I want to do is split this file into multiple files based on ONE
factor alone.
Field 12 (where is has  profdm1 in line 1)
If that field has a value, I want that line and all subsequent lines below
it where field 12 is null to be split into a file, then when it encounters
field 12 has a value in it, create a new file and repeat this process thru
the end of the file....

So the original file may have, for example, 5 lines where field 12 has a
value....so this process should split the csv file into 5 files.....each
having the line where field 12 has a value and ALL other lines below it,
UNTIL it finds the next line where field 12 has a value....

I have looked at awk/gawk and don't see anywhere that you can set
parameters to do this...
Perhaps Perl?

Hoping someone has had to do something like this before and knows a good
solution...

thanks

Scott
PDM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20140108/e63cfee3/attachment.html 


More information about the Filepro-list mailing list