One input file to multiple output files
- by user1265669
I found some helpful stuff on this site but my input file is different from the examples already posted and I cannot make the leap in an efficient manner.
My input file looks like this:
sample_dude data1 data2 data3 data4
sample_lady data5 data6 data7 data8
sample_dude data9 data10 data11 data12
sample_child data13 data14 data15 data16
I want to create a separate file for each sample with all the data columns. For example, one file would be called sample_dude.txt and look like this:
data1 data2 data3 data4
data9 data10 data11 data12
There is an unknown number of samples but always just four data columns.
Any help greatly appreciated. Thank you.
PS: I'm trying to do this in python.