I have a big file with many columns and rows, looks like:
A B C D E F1 F2 F3 F4 F5
a1 b1 c1 d1 e1 0 0 1 0 1
a2 b2 c2 d2 e2 1 0 0 1 1
a3 b3 c3 d3 e3 1 1 0 0 1
....
The A, B, C, D, E columns contain some information, and F1-5 columns represent some ids. The 0s or 1s mean absence/presence of the A-E information for that id.
I want to create files for each id, while every file contains the ABCDE information that the id has. For example, F5 have three 1s in the first 3 rows, so
F5.txt:
A B C D E
a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
a3 b3 c3 d3 e3
F1 has two 1s in the first 3 rows, so
F1.txt:
A B C D E
a2 b2 c2 d2 e2
a3 b3 c3 d3 e3
How to filter this file and create new files with the id names (F1, F2...) using awk?