I would like to extract tab-delimited columns from a text file ("columns.txt") in which the header (first line) matches certain strings listed in another text file ("strings.txt").
"columns.txt" looks like this:
rs2438689 rs54666437 rs9877702046 rs025436779...
0 0 0 1
1 1 2 2
0 1 2 0
... ... ... ...
"strings.txt" looks like this:
rs2438689
rs9877702046
...
The output text file "output.txt" should look like this (tab-delimited):
rs2438689 rs9877702046...
0 0
1 2
0 2
... ...
Any suggestions on how to do this with awk? Thank you!