I have a huge text file which have a data set like this
EOG61ZHH8 ENSRNOG00000004762 627
EOG61ZHH8 ENSRNOG00000004762 627
EOG61ZHH9 ENSG00000249709 1075
EOG61ZHH9 ENSG00000249709 230
EOG61ZHH9 ENSG00000249709 87
EOG61ZHHB ENSG00000134030 2347
EOG61ZHHB ENSG00000134030 3658
EOG61ZHHB ENSRNOG00000018342 241
EOG61ZHHB ENSRNOG00000018342 241
EOG61ZHHC ENSBTAG00000006084 1159
EOG61ZHHC ENSG00000158828 820
EOG61ZHHC ENSMMUG00000000126 631
and i want to convert or split it like this
EOG61ZHH8.txt
ENSRNOG00000004762 627
ENSRNOG00000004762 627
EOG61ZHH9.txt
ENSG00000249709 1075
ENSG00000249709 230
ENSG00000249709 87
and so on. I have no clue where to start getting new txt file from the text file above , i have done this thing before but that entries have '[' sign before entry start , now i have many files but not having any special sign to convert them This is the code which i had done in python
with open("entry.txt") as f:
for line in f:
if line[0] == "[":
if out: out.close()
out = open(line.split()[1] + ".txt", "w")
else: out.write(line)'
I am using it in windows , so i knw about linux awk command , so kindly need no information about linux
if line[0] == "[":? None of the lines you show start with a[. Also, is there supposed to be a bit of empty space at the start of each line?i have done this thing before but that entries have '[' sign before entry start , now i have many files but not having any special sign to convert them This is the code which i had done in python\t) or multiple spaces?