Split single file into multiple files based on patterns

Jason Friedman jason at powerpull.net
Tue Oct 23 23:36:49 EDT 2012


> I have a text file like this
>
> A1980JE39300007 2732 4195 12.527000
> A1980JE39300007 3465 9720 22.000000
> A1980KK18700010 186 3366 4.780000
> A1980KK18700010 30 186 1.285000
> A1980KK18700010 30 185 4.395000
> A1980KK18700010 185 186 9.000000
> A1980KK18700010 25 30 3.493000
>
> I want to split the file and get multiple files like A1980JE39300007.txt and A1980KK18700010.txt, where each file will contain column2, 3 and 4.

The sample data above shows the data grouped by file name.  Will this
be true generally?



More information about the Python-list mailing list