I have 2 files as input:
File 1 (space separated)
ID POS a0 a1
SNP1 123 A C
SNP2 456 T C
SNP3 789 G A
File 2 (space separated)
0 1 0 1 0 0 0 1
1 1 0 0 1 0 0 1
0 1 1 1 0 0 0 1
Required output
A C A C A A A C
C C T T C T T C
G A A A G G G A
Each line in file 2 represent 1 Line in File 1, the trick is to substitute the 0 and 1 for the corresponding letter in a0 and a1 respectively. This is just a small example, the real file is huge, more than 600K lines.
I am looking for an awk or perl solution.
A C A C A A A C
?